1

I am using ubuntu 13.04

Version of ffmpeg is ffmpeg version N-61041-g52a2138

Through php, I am calling ffmpeg commands to extract images and do some modification in those images and again merge those images back to video.

While merging all images through ffmpeg command, I need to pass video bit rates.

Command is as below

public function mergeImagesToVideo($frame_no,$user_directory_name,$video_bit_rates,&$output,&$status){
        /* merge all of frames to create one second video */

        $user_frames_path=$GLOBALS["all_user_dir_path"].$user_directory_name."/";

        $command= $GLOBALS['ffmpeg'].' -f image2 -r 30 -i '.
                  $user_frames_path.'f'.$frame_no.'_%d.png -r 30 -b:v '
                  .$video_bit_rates.'k '.$user_frames_path.'f'.$frame_no.'.mp4';

        //echo $command;
        exec($command,$output,$status);
        return;
    }

The call is made as below

$this->mergeImagesToVideo($start_second,$user_directory,$video_bit_rates,$output,$status);

              if($status!=0){
                echo "some thing went wrong in merging all images to create a video <br>";
              }

Now When check bit rates through ffmpeg command output is like as below

ffmpeg -i f1.mp4

This command shows 7303 kb/s

enter image description here

While I right click the image and show properties, it shows 7295 kbps

enter image description here

Which is the correct one ?? Not getting correct line..

Thanks in advance.

gkd
  • 853
  • 1
  • 14
  • 31
  • 1
    Read through the following mailing about the formulas, used in FFMPEG https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-February/005192.html and also check out this SO question http://stackoverflow.com/questions/5502654/ffmpeg-bitrate-calculation-optimization – Bud Damyanov May 07 '14 at 08:01
  • @bodio - I required to maintain same bit rate, letting ffmpeg to calculate bit rate on it's own is more risky, following command `ffmpeg -f image2 -r 30 -i f1_%d.png -r 30 foo.mp4` generated video with 6264 kb/s bit rate. – gkd May 07 '14 at 10:35
  • 2
    If I have to be specific to your question - you should trust the bit-rate, shown by FFMPEG console window, I suspect that the Gnome interface (more specifically the Nautilus) calculate the bit-rate by different formula. – Bud Damyanov May 07 '14 at 11:15
  • 1
    Correct @bodi0 , I have did that by default.. a little bit less (5 to 10 bits per second) bit rate is not a big problem. I just wanted to check was there any thing wrong/missing in my way of getting things. What you have suggested I am following currently. Thanks for your support. – gkd May 07 '14 at 13:22

0 Answers0