Ubuntu: FFmpeg multi pass encoding



Question:

Sorry, I am really new to this, and have problems doing some tasks without help.

So I have a terminal command:

ffmpeg \  -y \  -i '/media/levan/BEEA60D8EA608E89/Downloads/Videos/Tony Braxton - Un-Break My Heart.VOB' \  -s 1920x1080 \  -aspect 16:9 \  -r 25 \  -b 15550k \  -bt 19792k \  -vcodec libtheora \  -acodec libvorbis \  -ac 2 \  -ar 48000 \  -ab 320k \  ddd.ogg  

and I want to have 3 pass video in output video, but how do I accomplish this?

I found that I must write -pass n command some where, but where to write it I do not know. I tested this and wrote -pass 3 at the end but then the terminal just showed a > symbol.


Solution:1

Using your parameters, and your "one option per line", a two pass encode looks like:

ffmpeg \  -y \  -i '/media/levan/BEEA60D8EA608E89/Downloads/Videos/Tony Braxton - Un-Break My Heart.VOB' \  -s 1920x1080 \  -aspect 16:9 \  -r 25 \  -b 15550k \  -bt 19792k \  -vcodec libtheora \  -an \  -f ogg \  -pass 1 \  /dev/null \  && \  ffmpeg \  -y \  -i '/media/levan/BEEA60D8EA608E89/Downloads/Videos/Tony Braxton - Un-Break My Heart.VOB' \  -s 1920x1080 \  -aspect 16:9 \  -r 25 \  -b 15550k \  -bt 19792k \  -vcodec libtheora \  -acodec libvorbis \  -ac 2 \  -ar 48000 \  -ab 320k \  -pass 2 \  ddd.ogg  

You can exclude the audio from the first pass and output to /dev/null (as in the example). I don't see any reason why you need three passes.


Solution:2

I would suggest you not use the shell script source ~/bin/audio_video_conversions.sh and instead run the 2 commands on the command line, one after the other in order to find out where it is breaking.

I think you need to find out why you are getting this

Unable to find a suitable output format for '/dev/null'  

on your first pass. Look in your directory with

ls   

command. Make sure you have a

ffmpeg2pass-0.log  

file created after the pass-1.

You asked ffmpeg to do a 2-pass convert to find variance in the bitrate in the pass-1, log bitrate information to a file, and use the logfile to make a more efficient better pass-2. But you also told ffmpeg don't change the bitrate. Can not do both.

-bt 19792k \  

Which do you want? You want ffmpeg to change the bitrate with 2-pass? OR You want ffmpeg keep -bt 19792k with only 1-pass?

[libx264 @ 0x195fd20] constant rate-factor is incompatible with 2pass.  


Solution:3

So, what I understand is that first pass is to get informations for second... I've heard that the more pass you do the smallest is your file. Trying to get from a VOB file a mpeg-4 file, I'm having following function, could anybody help me?

My Function:

avconv -i $fileName -threads auto -c:v libx264 -preset veryslow -pass 1 /dev/null;  logInfo "First Pass done! doing second......"  avconv -i $fileName -pass 2 -threads auto -c:v libx264 -preset veryslow ${targetFile};  

result:

pg@pipoTower: /var/autofs/removable/usbData/movies/.../VIDEO_TS$ source ~/bin/audio_video_conversions.sh ;my_convert_to_mpeg4_2pass VTS_01_1.VOB  INFO --> Converting with 2 passes source file:VTS_01_1.VOB- date is Fri Aug 30 15:15:28 CEST 2013  INFO --> Target file name:VTS_01_1_20130830_151528.mp4-  avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers  built on Mar 30 2013 22:20:06 with gcc 4.7.2  [mpeg @ 0x11d6b80] max_analyze_duration reached  Input #0, mpeg, from 'VTS_01_1.VOB':  Duration: 00:17:10.62, start: 0.280000, bitrate: 8334 kb/s  Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 8500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc  Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s  Unable to find a suitable output format for '/dev/null'  INFO --> First Pass done! doing second......  avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers  built on Mar 30 2013 22:20:06 with gcc 4.7.2  [mpeg @ 0x1952b80] max_analyze_duration reached  Input #0, mpeg, from 'VTS_01_1.VOB':  Duration: 00:17:10.62, start: 0.280000, bitrate: 8334 kb/s  Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 8500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc  Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s  [buffer @ 0x19620c0] w:720 h:576 pixfmt:yuv420p  [libx264 @ 0x195fd20] using SAR=16/15  [libx264 @ 0x195fd20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX XOP FMA4 SSEMisalign LZCNT  [libx264 @ 0x195fd20] constant rate-factor is incompatible with 2pass.  Output #0, mp4, to 'VTS_01_1_20130830_151528.mp4':  Stream #0.0: Video: libx264, yuv420p, 720x576 [PAR 16:15 DAR 4:3], q=-1--1, pass 2, 90k tbn, 25 tbc  Stream #0.1: Audio: [0][0][0][0] / 0x0000, 48000 Hz, stereo, s16, 200 kb/s  Stream mapping:  Stream #0:0 -> #0:0 (mpeg2video -> libx264)  Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)  Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »