/ Published in: Bash
ffmpeg to create video that will upload OK to youtube
2 pass libx264 encoder followed by 1-pass .wmv output example
2 pass libx264 encoder followed by 1-pass .wmv output example
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
./bin/ffmpeg -y -loop_input -shortest -i Optimized-DSC01448.JPG -i rec_1448.3gpp \ -pass 1 -vframes 500 -vcodec libx264 -r 1/50 -vf 'scale=320:180' -b 5k -g 250 \ -b_strategy 0 -coder 1 -qmin 10 -qmax 55 -sc_threshold 40 -flags -loop -subq 1 \ -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -flags2 +dct8x8+wpred+ \ bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 \ -acodec libmp3lame -ar 44100 -ab 44100 output.mp4 ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 22 2011 17:37:00 with gcc 4.5.3 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, image2, from 'Optimized-DSC01448.JPG': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: mjpeg, yuvj420p, 640x425 [PAR 96:96 DAR 128:85], 25 fps, 25 tbr, 25 tbn, 25 tbc Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1448.3gpp': Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 Duration: 00:02:55.76, start: 0.000000, bitrate: 5 kb/s Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16' [buffer @ 0000000001DDD340] w:640 h:425 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param: [scale @ 000000000495CF80] w:640 h:425 fmt:yuvj420p -> w:320 h:180 fmt:yuvj420p flags:0x4 [libx264 @ 0000000001DDF7C0] using SAR=1/1 [libx264 @ 0000000001DDF7C0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0000000001DDF7C0] profile Main, level 1.1 [libx264 @ 0000000001DDF7C0] 264 - core 115 r2008 4c552d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 r ef=1 deblock=0:0:0 analyse=0x1:0 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=4 chroma_me=0 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 c hroma_qp_offset=0 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25 scene cut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=5 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=55 qpstep=4 ip_ratio=1.41 aq=1:1.00 Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf53.4.0 Stream #0.0: Video: libx264, yuvj420p, 320x180 [PAR 96:96 DAR 16:9], q=10-55, pass 1, 5 kb/s, 1 tbn, 0.02 tbc Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 1 channels, s16, 44 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Press [q] to stop, [?] for help Warning, using s16 intermediate sample format for resamplingitrate= 0.0kbits/s dup=0 drop=49758 frame= 45 fps= 0 q=13.0 Lsize= 967kB time=00:02:55.80 bitrate= 45.1kbits/s dup=0 drop=53582 video:55kB audio:858kB global headers:0kB muxing overhead 5.925287% frame I:1 Avg QP:10.00 size: 53819 [libx264 @ 0000000001DDF7C0] frame P:44 Avg QP:10.30 size: 33 [libx264 @ 0000000001DDF7C0] mb I I16..4: 0.0% 0.0% 100.0% [libx264 @ 0000000001DDF7C0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 2.0% 0.0% 0.0% 0.0% 0.0% skip:98.0% [libx264 @ 0000000001DDF7C0] final ratefactor: -11.55 [libx264 @ 0000000001DDF7C0] coded y,uvDC,uvAC intra: 96.4% 98.8% 95.4% inter: 0.5% 0.1% 0.0% [libx264 @ 0000000001DDF7C0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 28% 11% 4% 8% 5% 8% 7% 12% [libx264 @ 0000000001DDF7C0] i8c dc,h,v,p: 38% 36% 16% 10% [libx264 @ 0000000001DDF7C0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0000000001DDF7C0] kb/s:0.20 ./bin/ffmpeg -y -loop_input -shortest -i Optimized-DSC01448.JPG -i rec_1448.3gpp \ -pass 2 -vframes 500 -vcodec libx264 -r 1/50 -vf 'scale=320:180' -b 5k -g 250 \ -b_strategy 0 -coder 1 -qmin 10 -qmax 55 -sc_threshold 40 -flags -loop -subq 1 \ -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -flags2 \ +dct8x8+wpred+ bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 \ -acodec libmp3lame -ar 44100 -ab 44100 output.mp4 ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 22 2011 17:37:00 with gcc 4.5.3 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, image2, from 'Optimized-DSC01448.JPG': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: mjpeg, yuvj420p, 640x425 [PAR 96:96 DAR 128:85], 25 fps, 25 tbr, 25 tbn, 25 tbc Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1448.3gpp': Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 Duration: 00:02:55.76, start: 0.000000, bitrate: 5 kb/s Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16' [buffer @ 00000000002DD340] w:640 h:425 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param: [scale @ 000000000495CF80] w:640 h:425 fmt:yuvj420p -> w:320 h:180 fmt:yuvj420p flags:0x4 [libx264 @ 00000000002DF7C0] using SAR=1/1 [libx264 @ 00000000002DF7C0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 00000000002DF7C0] Error: 2pass curve failed to converge [libx264 @ 00000000002DF7C0] target: 5.00 kbit/s, expected: 0.20 kbit/s, avg QP: 10.0003 [libx264 @ 00000000002DF7C0] try reducing target bitrate or reducing qp_min (currently 10) [libx264 @ 00000000002DF7C0] profile High, level 1.1 [libx264 @ 00000000002DF7C0] 264 - core 115 r2008 4c552d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 r ef=1 deblock=0:0:0 analyse=0x3:0x133 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=4 chroma_me=0 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip =1 chroma_qp_offset=0 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25 s cenecut=40 intra_refresh=0 rc_lookahead=40 rc=2pass mbtree=1 bitrate=5 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=55 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.41 a q=1:1.00 Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf53.4.0 Stream #0.0: Video: libx264, yuvj420p, 320x180 [PAR 96:96 DAR 16:9], q=10-55, pass 2, 5 kb/s, 1 tbn, 0.02 tbc Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 1 channels, s16, 44 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Press [q] to stop, [?] for help [libx264 @ 00000000002DF7C0] lookaheadless mb-tree requires intra refresh or infinite keyint Warning, using s16 intermediate sample format for resampling frame= 5 fps= 0 q=10.0 Lsize= 956kB time=00:02:55.80 bitrate= 44.5kbits/s dup=0 drop=3621 video:44kB audio:858kB global headers:0kB muxing overhead 5.963164% frame I:1 Avg QP:14.48 size: 43853 [libx264 @ 00000000002DF7C0] frame P:4 Avg QP:10.14 size: 24 [libx264 @ 00000000002DF7C0] mb I I16..4: 0.0% 0.0% 100.0% [libx264 @ 00000000002DF7C0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.9% 0.0% 0.0% 0.0% 0.0% skip:99.1% [libx264 @ 00000000002DF7C0] 8x8 transform intra:0.0% inter:100.0% [libx264 @ 00000000002DF7C0] coded y,uvDC,uvAC intra: 95.7% 98.8% 95.4% inter: 0.1% 0.9% 0.0% [libx264 @ 00000000002DF7C0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 27% 11% 4% 8% 5% 9% 7% 12% [libx264 @ 00000000002DF7C0] i8c dc,h,v,p: 38% 35% 15% 11% [libx264 @ 00000000002DF7C0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 00000000002DF7C0] kb/s:1.41 ==== output .wmv below $FFMPEG_HOME/bin/ffmpeg -y -loop_input -f image2 -shortest -r 1/2 -i Optimized-DSC01459.JPG -i rec_1459.3gpp -s 640x480 -b 100k -bt 240k -vcodec msmpeg4 -acodec libmp 3lame -ab 64k -ar 22050 out_my.wmv ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 22 2011 17:37:00 with gcc 4.5.3 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 [image2 @ 0000000001C75900] max_analyze_duration 5000000 reached at 6000000 Input #0, image2, from 'Optimized-DSC01459.JPG': Duration: 00:00:02.00, start: 0.000000, bitrate: N/A Stream #0.0: Video: mjpeg, yuvj420p, 1200x798 [PAR 96:96 DAR 200:133], 0.50 fps, 0.50 tbr, 0.50 tbn, 0.50 tbc Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1459.3gpp': Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 Duration: 00:02:33.62, start: 0.000000, bitrate: 5 kb/s Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16' Incompatible pixel format 'yuvj420p' for codec 'msmpeg4', auto-selecting format 'yuv420p' [buffer @ 000000000027BD20] w:1200 h:798 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param: [scale @ 0000000003C19D80] w:1200 h:798 fmt:yuvj420p -> w:640 h:480 fmt:yuv420p flags:0x4 Output #0, asf, to 'e:/movies/dev/r2_640x480_vid_only_1459.wmv': Metadata: WM/EncodingSettings: Lavf53.4.0 Stream #0.0: Video: msmpeg4, yuv420p, 640x480 [PAR 96:96 DAR 4:3], q=2-31, 100 kb/s, 1k tbn, 0.50 tbc Stream #0.1(eng): Audio: libmp3lame, 22050 Hz, 1 channels, s16, 64 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Press [q] to stop, [?] for help Warning, using s16 intermediate sample format for resampling frame= 77 fps= 29 q=2.0 Lsize= 2277kB time=00:02:33.67 bitrate= 121.4kbits/s video:946kB audio:1201kB global headers:0kB muxing overhead 6.048880%