![Ffmpeg:音频/视频混合但没有声音](https://linux22.com/image/1393531/Ffmpeg%EF%BC%9A%E9%9F%B3%E9%A2%91%2F%E8%A7%86%E9%A2%91%E6%B7%B7%E5%90%88%E4%BD%86%E6%B2%A1%E6%9C%89%E5%A3%B0%E9%9F%B3.png)
我正在尝试将音频文件添加到使用 FFmpeg 从图像生成的视频文件中。
我在 Debian 发行版上使用的命令是这个
ffmpeg -r 1 -i edit%0d.jpg outputName.mp4 -i Test.mp3
视频文件已创建,但音频不起作用。
输出 ::
> ffmpeg version 0.8.9-6:0.8.9-1, Copyright (c) 2000-2013 the Libav developers
built on Nov 3 2013 00:54:50 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[image2 @ 0x2283b20] max_analyze_duration reached
Input #0, image2, from 'edit%0d.jpg':
Duration: 00:00:24.00, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 800x600 [PAR 1:1 DAR 4:3], 1 fps, 1 tbr, 1 tbn, 1 tbc
[mp3 @ 0x22d8840] max_analyze_duration reached
[mp3 @ 0x22d8840] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'Test.mp3':
Duration: 00:00:46.04, start: 0.000000, bitrate: 128 kb/s
Stream #1.0: Audio: mp3, 16000 Hz, mono, s16, 128 kb/s
[buffer @ 0x2287480] w:800 h:600 pixfmt:yuvj420p
[libx264 @ 0x22d7d20] using SAR=1/1
[libx264 @ 0x22d7d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x22d7d20] profile Main, level 3.1
[libx264 @ 0x22d7d20] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=1 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00
Output #0, mp4, to '6953289.mp4':
Metadata:
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuvj420p, 800x600 [PAR 1:1 DAR 4:3], q=-1--1, 1 tbn, 1 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame= 24 fps= 16 q=17.0 Lsize= 1247kB time=23.00 bitrate= 444.1kbits/s
video:1246kB audio:0kB global headers:0kB muxing overhead 0.079555%
frame I:1 Avg QP:14.91 size: 65650
[libx264 @ 0x22d7d20] frame P:23 Avg QP:14.94 size: 52587
[libx264 @ 0x22d7d20] mb I I16..4: 11.8% 0.0% 88.2%
[libx264 @ 0x22d7d20] mb P I16..4: 29.8% 0.0% 60.5% P16..4: 6.8% 0.2% 0.3% 0.0% 0.0% skip: 2.4%
[libx264 @ 0x22d7d20] coded y,uvDC,uvAC intra: 73.2% 58.6% 49.7% inter: 9.2% 8.0% 1.2%
[libx264 @ 0x22d7d20] i16 v,h,dc,p: 56% 24% 6% 14%
[libx264 @ 0x22d7d20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 22% 12% 7% 7% 7% 7% 7% 7%
[libx264 @ 0x22d7d20] i8c dc,h,v,p: 60% 17% 13% 9%
[libx264 @ 0x22d7d20] Weighted P-Frames: Y:17.4% UV:17.4%
[libx264 @ 0x22d7d20] ref P L0: 12.9% 8.0% 66.4% 12.8%
[libx264 @ 0x22d7d20] kb/s:425.05
在 Windows 上它运行良好,我尝试了多种场景,但似乎找不到问题,也许是编解码器问题?
谢谢 !
更新 :
我设法通过以下方式修复它:
ffmpeg -r 1 -i edit%0d.jpg -i Test.mp3 -ar 44100 -strict experimental
答案1
仅映射视频流:
Output #0, mp4, to '6953289.mp4':
Metadata:
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuvj420p, 800x600 [PAR 1:1 DAR 4:3], q=-1--1, 1 tbn, 1 tbc
Stream mapping:
Stream #0.0 -> #0.0
我很确定您仍然必须在那里指定比特率和分辨率。
以前也做过类似的事情:为 YouTube 创建带有音频和静态图像的视频