合并一张幻灯片,音频使用ffmpeg-输出仅在视频容器中的音频(一张幻灯片在vid tr中)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了合并一张幻灯片,音频使用ffmpeg-输出仅在视频容器中的音频(一张幻灯片在vid tr中)相关的知识,希望对你有一定的参考价值。
podcast to youtube . the output will upload ok using mpeg container for audio only2 examples:
2 pass libx264
output .wmv file
=============== 2 pass libx264 example outputs mp4 file with low video bandwidth ./ffmpeg -y -loop_input -shortest -i test_album_cover.png -i rec_1448.3gpp -pass 1 -vframes 500 -vcodec libx264 -r 1/100 -vf 'scale=320:180' -b 2k -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 -ac 1 -ar 22050 -ab 22k t_album.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 [image2 @ 000000000026BA60] max_analyze_duration 5000000 reached at 5000000 Input #0, image2, from 'test_album_cover.png': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: png, rgb24, 671x799, 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' Incompatible pixel format 'rgb24' for codec 'libx264', auto-selecting format 'yuv420p' [buffer @ 0000000000306CE0] w:671 h:799 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [scale @ 0000000000306DE0] w:671 h:799 fmt:rgb24 -> w:320 h:180 fmt:yuv420p flags:0x4 [libx264 @ 000000000026A540] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 000000000026A540] profile Main, level 1.1 [libx264 @ 000000000026A540] 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=2 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=55 qpstep=4 ip_ratio=1.41 aq=1:1.00 Output #0, mp4, to 't_album_cover.mp4': Metadata: encoder : Lavf53.4.0 Stream #0.0: Video: libx264, yuv420p, 320x180, q=10-55, pass 1, 2 kb/s, 1 tbn, 0.01 tbc Stream #0.1(eng): Audio: libmp3lame, 22050 Hz, 1 channels, s16, 22 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=99698 frame= 43 fps= 0 q=13.0 Lsize= 575kB time=00:02:55.83 bitrate= 26.8kbits/s dup=0 drop=102209 video:6kB audio:515kB global headers:0kB muxing overhead 10.379900% frame I:1 Avg QP:10.00 size: 2777 [libx264 @ 000000000026A540] frame P:42 Avg QP:10.44 size: 61 [libx264 @ 000000000026A540] mb I I16..4: 79.6% 0.0% 20.4% [libx264 @ 000000000026A540] mb P I16..4: 21.2% 0.0% 0.0% P16..4: 0.8% 0.0% 0.0% 0.0% 0.0% skip:78.0% [libx264 @ 000000000026A540] final ratefactor: -23.41 [libx264 @ 000000000026A540] coded y,uvDC,uvAC intra: 1.6% 2.6% 2.5% inter: 0.2% 0.0% 0.0% [libx264 @ 000000000026A540] i16 v,h,dc,p: 98% 2% 0% 0% [libx264 @ 000000000026A540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 38% 19% 0% 2% 0% 1% 0% 2% [libx264 @ 000000000026A540] i8c dc,h,v,p: 37% 62% 1% 0% [libx264 @ 000000000026A540] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 000000000026A540] kb/s:0.01 pass #2: ./ffmpeg -y -loop_input -shortest -i test_album_cover.png -i rec_1448.3gpp -pass 2 -vframes 500 -vcodec libx264 -r 1/100 -vf 'scale=320:180' -b 2k -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 -ac 1 -ar 22050 -ab 22k t_album.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 [image2 @ 000000000035BA60] max_analyze_duration 5000000 reached at 5000000 Input #0, image2, from 'test_album_cover.png': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: png, rgb24, 671x799, 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' Incompatible pixel format 'rgb24' for codec 'libx264', auto-selecting format 'yuv420p' [buffer @ 00000000002D6CE0] w:671 h:799 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [scale @ 00000000002D6DE0] w:671 h:799 fmt:rgb24 -> w:320 h:180 fmt:yuv420p flags:0x4 [libx264 @ 000000000035A540] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 000000000035A540] Error: 2pass curve failed to converge [libx264 @ 000000000035A540] target: 2.00 kbit/s, expected: 0.01 kbit/s, avg QP: 10.0000 [libx264 @ 000000000035A540] try reducing target bitrate or reducing qp_min (currently 10) [libx264 @ 000000000035A540] profile High, level 1.1 [libx264 @ 000000000035A540] 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=2 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 't_album_cover.mp4': Metadata: encoder : Lavf53.4.0 Stream #0.0: Video: libx264, yuv420p, 320x180, q=10-55, pass 2, 2 kb/s, 1 tbn, 0.01 tbc Stream #0.1(eng): Audio: libmp3lame, 22050 Hz, 1 channels, s16, 22 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= 3 fps= 0 q=12.0 Lsize= 573kB time=00:02:55.83 bitrate= 26.7kbits/s dup=0 drop=2248 video:4kB audio:515kB global headers:0kB muxing overhead 10.362358% frame I:1 Avg QP:10.00 size: 2940 [libx264 @ 000000000035A540] frame P:2 Avg QP:10.03 size: 93 [libx264 @ 000000000035A540] mb I I16..4: 77.9% 2.5% 19.6% [libx264 @ 000000000035A540] mb P I16..4: 21.3% 0.0% 0.0% P16..4: 2.9% 0.0% 0.0% 0.0% 0.0% skip:75.8% [libx264 @ 000000000035A540] 8x8 transform intra:1.8% inter:70.0% [libx264 @ 000000000035A540] coded y,uvDC,uvAC intra: 10.3% 18.1% 16.4% inter: 0.9% 1.1% 0.0% [libx264 @ 000000000035A540] i16 v,h,dc,p: 87% 13% 0% 0% [libx264 @ 000000000035A540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 33% 54% 0% 8% 0% 4% 0% 0% [libx264 @ 000000000035A540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 44% 13% 0% 1% 0% 0% 0% 2% [libx264 @ 000000000035A540] i8c dc,h,v,p: 29% 63% 9% 0% [libx264 @ 000000000035A540] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 000000000035A540] kb/s:0.08 =============== output .wmv file FFMPEG_HOME=C:/e/utility/ffmpeg-git-81ef892-win64-static FFMPEG_DATADIR=$MPEG_HOME/presets $FFMPEG_HOME/bin/ffmpeg -loop_input -r ntsc -i Optimized-DSC01459.JPG -i rec_1459.3gpp -r .2 -s 640x480 -b 100k -bt 240k -acodec libmp3lame -ar 22050 -vcodec libx264 -vpre ipod640 -crf 22 -threads 0 -shortest e:/movies/dev/output_r.mp4 --stdout Input #0, image2, from 'Optimized-DSC01459.JPG': Duration: 00:00:00.03, start: 0.000000, bitrate: N/A Stream #0.0: Video: mjpeg, yuvj420p, 1200x798 [PAR 96:96 DAR 200:133], 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 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' File 'e:/movies/dev/output_r.mp4' already exists. Overwrite ? [y/N] y [buffer @ 0000000004B4E6A0] w:1200 h:798 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param: [scale @ 0000000004B4E7A0] w:1200 h:798 fmt:yuvj420p -> w:640 h:480 fmt:yuvj420p flags:0x4 [libx264 @ 0000000001E49460] Default settings detected, using medium profile [libx264 @ 0000000001E49460] using SAR=1/1 [libx264 @ 0000000001E49460] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0000000001E49460] VBV buffer size cannot be smaller than one frame, using 49999 kbit [libx264 @ 0000000001E49460] profile High, level 3.0 [libx264 @ 0000000001E49460] 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=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski p=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 dir ect=1 weightb=1 open_gop=0 weightp=0 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qp step=4 vbv_maxrate=10000 vbv_bufsize=49999 crf_max=0.0 nal_hrd=none ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'e:/movies/dev/output_r.mp4': Metadata: encoder : Lavf53.4.0 Stream #0.0: Video: libx264, yuvj420p, 640x480 [PAR 96:96 DAR 4:3], q=2-31, 100 kb/s, 1 tbn, 0.20 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 [libx264 @ 0000000001E49460] VBV buffer size cannot be smaller than one frame, using 49999 kbit Warning, using s16 intermediate sample format for resamplingitrate= 0.0kbits/s dup=0 drop=6825 Last message repeated 1 times 1340kB time=00:02:30.00 bitrate= 73.2kbits/s dup=0 drop=11563 frame= 80 fps= 1 q=29.0 Lsize= 1457kB time=00:02:33.67 bitrate= 77.7kbits/s dup=0 drop=11595 video:208kB audio:1201kB global headers:0kB muxing overhead 3.437844% frame I:1 Avg QP:10.49 size:211039 [libx264 @ 0000000001E49460] frame P:20 Avg QP:21.57 size: 24 [libx264 @ 0000000001E49460] frame B:59 Avg QP:29.00 size: 19 [libx264 @ 0000000001E49460] consecutive B-frames: 1.3% 0.0% 3.8% 95.0% [libx264 @ 0000000001E49460] mb I I16..4: 0.2% 17.6% 82.3% [libx264 @ 0000000001E49460] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip:99.9% [libx264 @ 0000000001E49460] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0% L0:-1.$% L1:-1.$% BI:-1.$% [libx264 @ 0000000001E49460] 8x8 transform intra:17.6% [libx264 @ 0000000001E49460] coded y,uvDC,uvAC intra: 99.6% 98.3% 97.5% inter: 0.0% 0.0% 0.0% [libx264 @ 0000000001E49460] i16 v,h,dc,p: 0% 50% 0% 50% [libx264 @ 0000000001E49460] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 28% 13% 6% 6% 6% 7% 6% 12% [libx264 @ 0000000001E49460] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 15% 11% 8% 7% 10% 9% 9% 12% [libx264 @ 0000000001E49460] i8c dc,h,v,p: 44% 24% 23% 10% [libx264 @ 0000000001E49460] kb/s:4.25 bench: utime=122.055s maxrss=98648kB
以上是关于合并一张幻灯片,音频使用ffmpeg-输出仅在视频容器中的音频(一张幻灯片在vid tr中)的主要内容,如果未能解决你的问题,请参考以下文章