将youtube上传的幻灯片和音频与ffmpeg合并

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将youtube上传的幻灯片和音频与ffmpeg合并相关的知识,希望对你有一定的参考价值。

ffmpeg to create video that will upload OK to youtube
2 pass libx264 encoder followed by 1-pass .wmv output example
  1. ./bin/ffmpeg -y -loop_input -shortest -i Optimized-DSC01448.JPG -i rec_1448.3gpp
  2. -pass 1 -vframes 500 -vcodec libx264 -r 1/50 -vf 'scale=320:180' -b 5k -g 250
  3. -b_strategy 0 -coder 1 -qmin 10 -qmax 55 -sc_threshold 40 -flags -loop -subq 1
  4. -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -flags2 +dct8x8+wpred+
  5. bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
  6. -acodec libmp3lame -ar 44100 -ab 44100 output.mp4
  7.  
  8. ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers
  9. built on Jun 22 2011 17:37:00 with gcc 4.5.3
  10. configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
  11. pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
  12. --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  13. libavutil 51. 9. 1 / 51. 9. 1
  14. libavcodec 53. 7. 0 / 53. 7. 0
  15. libavformat 53. 4. 0 / 53. 4. 0
  16. libavdevice 53. 1. 1 / 53. 1. 1
  17. libavfilter 2. 23. 0 / 2. 23. 0
  18. libswscale 2. 0. 0 / 2. 0. 0
  19. libpostproc 51. 2. 0 / 51. 2. 0
  20. Input #0, image2, from 'Optimized-DSC01448.JPG':
  21. Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
  22. Stream #0.0: Video: mjpeg, yuvj420p, 640x425 [PAR 96:96 DAR 128:85], 25 fps, 25 tbr, 25 tbn, 25 tbc
  23. Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1448.3gpp':
  24. Metadata:
  25. major_brand : 3gp4
  26. minor_version : 0
  27. compatible_brands: isom3gp4
  28. Duration: 00:02:55.76, start: 0.000000, bitrate: 5 kb/s
  29. Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s
  30. Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16'
  31. [buffer @ 0000000001DDD340] w:640 h:425 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param:
  32. [scale @ 000000000495CF80] w:640 h:425 fmt:yuvj420p -> w:320 h:180 fmt:yuvj420p flags:0x4
  33. [libx264 @ 0000000001DDF7C0] using SAR=1/1
  34. [libx264 @ 0000000001DDF7C0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
  35. [libx264 @ 0000000001DDF7C0] profile Main, level 1.1
  36. [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
  37. 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
  38. 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
  39. 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
  40. Output #0, mp4, to 'output.mp4':
  41. Metadata:
  42. encoder : Lavf53.4.0
  43. 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
  44. Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 1 channels, s16, 44 kb/s
  45. Stream mapping:
  46. Stream #0.0 -> #0.0
  47. Stream #1.0 -> #0.1
  48. Press [q] to stop, [?] for help
  49. Warning, using s16 intermediate sample format for resamplingitrate= 0.0kbits/s dup=0 drop=49758
  50. frame= 45 fps= 0 q=13.0 Lsize= 967kB time=00:02:55.80 bitrate= 45.1kbits/s dup=0 drop=53582
  51. video:55kB audio:858kB global headers:0kB muxing overhead 5.925287%
  52. frame I:1 Avg QP:10.00 size: 53819
  53. [libx264 @ 0000000001DDF7C0] frame P:44 Avg QP:10.30 size: 33
  54. [libx264 @ 0000000001DDF7C0] mb I I16..4: 0.0% 0.0% 100.0%
  55. [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%
  56. [libx264 @ 0000000001DDF7C0] final ratefactor: -11.55
  57. [libx264 @ 0000000001DDF7C0] coded y,uvDC,uvAC intra: 96.4% 98.8% 95.4% inter: 0.5% 0.1% 0.0%
  58. [libx264 @ 0000000001DDF7C0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 28% 11% 4% 8% 5% 8% 7% 12%
  59. [libx264 @ 0000000001DDF7C0] i8c dc,h,v,p: 38% 36% 16% 10%
  60. [libx264 @ 0000000001DDF7C0] Weighted P-Frames: Y:0.0% UV:0.0%
  61. [libx264 @ 0000000001DDF7C0] kb/s:0.20
  62.  
  63.  
  64. ./bin/ffmpeg -y -loop_input -shortest -i Optimized-DSC01448.JPG -i rec_1448.3gpp
  65. -pass 2 -vframes 500 -vcodec libx264 -r 1/50 -vf 'scale=320:180' -b 5k -g 250
  66. -b_strategy 0 -coder 1 -qmin 10 -qmax 55 -sc_threshold 40 -flags -loop -subq 1
  67. -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -flags2 +dct8x8+wpred+
  68. bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
  69. -acodec libmp3lame -ar 44100 -ab 44100 output.mp4
  70.  
  71.  
  72. ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers
  73. built on Jun 22 2011 17:37:00 with gcc 4.5.3
  74. configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
  75. pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
  76. --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  77. libavutil 51. 9. 1 / 51. 9. 1
  78. libavcodec 53. 7. 0 / 53. 7. 0
  79. libavformat 53. 4. 0 / 53. 4. 0
  80. libavdevice 53. 1. 1 / 53. 1. 1
  81. libavfilter 2. 23. 0 / 2. 23. 0
  82. libswscale 2. 0. 0 / 2. 0. 0
  83. libpostproc 51. 2. 0 / 51. 2. 0
  84. Input #0, image2, from 'Optimized-DSC01448.JPG':
  85. Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
  86. Stream #0.0: Video: mjpeg, yuvj420p, 640x425 [PAR 96:96 DAR 128:85], 25 fps, 25 tbr, 25 tbn, 25 tbc
  87. Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1448.3gpp':
  88. Metadata:
  89. major_brand : 3gp4
  90. minor_version : 0
  91. compatible_brands: isom3gp4
  92. Duration: 00:02:55.76, start: 0.000000, bitrate: 5 kb/s
  93. Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s
  94. Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16'
  95. [buffer @ 00000000002DD340] w:640 h:425 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param:
  96. [scale @ 000000000495CF80] w:640 h:425 fmt:yuvj420p -> w:320 h:180 fmt:yuvj420p flags:0x4
  97. [libx264 @ 00000000002DF7C0] using SAR=1/1
  98. [libx264 @ 00000000002DF7C0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
  99. [libx264 @ 00000000002DF7C0] Error: 2pass curve failed to converge
  100. [libx264 @ 00000000002DF7C0] target: 5.00 kbit/s, expected: 0.20 kbit/s, avg QP: 10.0003
  101. [libx264 @ 00000000002DF7C0] try reducing target bitrate or reducing qp_min (currently 10)
  102. [libx264 @ 00000000002DF7C0] profile High, level 1.1
  103. [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
  104. 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
  105. =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
  106. 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
  107. q=1:1.00
  108. Output #0, mp4, to 'output.mp4':
  109. Metadata:
  110. encoder : Lavf53.4.0
  111. 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
  112. Stream #0.1(eng): Audio: libmp3lame, 44100 Hz, 1 channels, s16, 44 kb/s
  113. Stream mapping:
  114. Stream #0.0 -> #0.0
  115. Stream #1.0 -> #0.1
  116. Press [q] to stop, [?] for help
  117. [libx264 @ 00000000002DF7C0] lookaheadless mb-tree requires intra refresh or infinite keyint
  118. Warning, using s16 intermediate sample format for resampling
  119. frame= 5 fps= 0 q=10.0 Lsize= 956kB time=00:02:55.80 bitrate= 44.5kbits/s dup=0 drop=3621
  120. video:44kB audio:858kB global headers:0kB muxing overhead 5.963164%
  121. frame I:1 Avg QP:14.48 size: 43853
  122. [libx264 @ 00000000002DF7C0] frame P:4 Avg QP:10.14 size: 24
  123. [libx264 @ 00000000002DF7C0] mb I I16..4: 0.0% 0.0% 100.0%
  124. [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%
  125. [libx264 @ 00000000002DF7C0] 8x8 transform intra:0.0% inter:100.0%
  126. [libx264 @ 00000000002DF7C0] coded y,uvDC,uvAC intra: 95.7% 98.8% 95.4% inter: 0.1% 0.9% 0.0%
  127. [libx264 @ 00000000002DF7C0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 27% 11% 4% 8% 5% 9% 7% 12%
  128. [libx264 @ 00000000002DF7C0] i8c dc,h,v,p: 38% 35% 15% 11%
  129. [libx264 @ 00000000002DF7C0] Weighted P-Frames: Y:0.0% UV:0.0%
  130. [libx264 @ 00000000002DF7C0] kb/s:1.41
  131.  
  132.  
  133. ==== output .wmv below
  134.  
  135. $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
  136. 3lame -ab 64k -ar 22050 out_my.wmv
  137.  
  138. ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers
  139. built on Jun 22 2011 17:37:00 with gcc 4.5.3
  140. configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
  141. pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
  142. --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  143. libavutil 51. 9. 1 / 51. 9. 1
  144. libavcodec 53. 7. 0 / 53. 7. 0
  145. libavformat 53. 4. 0 / 53. 4. 0
  146. libavdevice 53. 1. 1 / 53. 1. 1
  147. libavfilter 2. 23. 0 / 2. 23. 0
  148. libswscale 2. 0. 0 / 2. 0. 0
  149. libpostproc 51. 2. 0 / 51. 2. 0
  150. [image2 @ 0000000001C75900] max_analyze_duration 5000000 reached at 6000000
  151. Input #0, image2, from 'Optimized-DSC01459.JPG':
  152. Duration: 00:00:02.00, start: 0.000000, bitrate: N/A
  153. 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
  154. Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'rec_1459.3gpp':
  155. Metadata:
  156. major_brand : 3gp4
  157. minor_version : 0
  158. compatible_brands: isom3gp4
  159. Duration: 00:02:33.62, start: 0.000000, bitrate: 5 kb/s
  160. Stream #1.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 5 kb/s
  161. Incompatible sample format 'flt' for codec 'libmp3lame', auto-selecting format 's16'
  162. Incompatible pixel format 'yuvj420p' for codec 'msmpeg4', auto-selecting format 'yuv420p'
  163. [buffer @ 000000000027BD20] w:1200 h:798 pixfmt:yuvj420p tb:1/1000000 sar:96/96 sws_param:
  164. [scale @ 0000000003C19D80] w:1200 h:798 fmt:yuvj420p -> w:640 h:480 fmt:yuv420p flags:0x4
  165. Output #0, asf, to 'e:/movies/dev/r2_640x480_vid_only_1459.wmv':
  166. Metadata:
  167. WM/EncodingSettings: Lavf53.4.0
  168. Stream #0.0: Video: msmpeg4, yuv420p, 640x480 [PAR 96:96 DAR 4:3], q=2-31, 100 kb/s, 1k tbn, 0.50 tbc
  169. Stream #0.1(eng): Audio: libmp3lame, 22050 Hz, 1 channels, s16, 64 kb/s
  170. Stream mapping:
  171. Stream #0.0 -> #0.0
  172. Stream #1.0 -> #0.1
  173. Press [q] to stop, [?] for help
  174. Warning, using s16 intermediate sample format for resampling
  175. frame= 77 fps= 29 q=2.0 Lsize= 2277kB time=00:02:33.67 bitrate= 121.4kbits/s
  176. video:946kB audio:1201kB global headers:0kB muxing overhead 6.048880%

以上是关于将youtube上传的幻灯片和音频与ffmpeg合并的主要内容,如果未能解决你的问题,请参考以下文章

如何将视频文件与音频文件合并并保持创建时间?

使用 FFMPEG 流式传输 YouTube 音频的示例

FFMPEG音频问题Youtube Live

合并一张幻灯片,音频使用ffmpeg-输出仅在视频容器中的音频(一张幻灯片在vid tr中)

如何将多个 YouTube 视频合并为一个

Youtube Data API V3 Javascript - 将音频和图像上传为视频