FFmpeg不复制所有音频流 [英] FFmpeg not copying all audio streams
问题描述
我无法让ffmpeg复制.mp4文件中的所有音频流.经过数小时的在线搜索,似乎应该复制所有流(在示例4中):
I'm having trouble getting ffmpeg to copy all audio streams from a .mp4 file. After hours of searching online, it appears this should copy all streams (as shown in example 4 here):
ffmpeg -i in.mp4 -map 0 -c copy out.mp4
in.mp4
包含3个流:
- 视频
- 音轨1
- 音轨2
out.mp4
(应该与 in.mp4
相同)仅包含2个流:
out.mp4
(which should be identical to in.mp4
) contains only 2 streams:
- 视频
- 音轨1
FFmpeg似乎可以正确识别所有3个流,但不会将它们全部复制过来.FFmpeg 的输出:
FFmpeg does appear to correctly identify all 3 streams, but doesn't copy all of them over. Output from FFmpeg:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
从 ffmpeg -v 9 -loglevel 99 -i in.mp4
输出:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from in.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.36.100
Duration: 00:00:06.03, start: 0.000000, bitrate: 5582 kb/s
Stream #0:0(und), 1, 1/15360: Video: h264 (Main), 1 reference frame (avc1 /
0x31637661), yuv420p(tv, bt470bg/unknown/unknown, left), 1920x1080 (0x0) [SAR 1:
1 DAR 16:9], 0/1, 5317 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(und), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0000000001c2b9e0] Statistics: 153350 bytes read, 2 seeks
编辑2(已解决):我设法从此文件中找到了正确的语法票证.对于其他感兴趣的人,正确的语法是:
Edit 2 (solved): I managed to find the correct syntax from this ticket. For any others that are interested, the correct syntax is:
ffmpeg -i in.mp4 -vcodec copy -c:a copy -map 0 out.mp4
这将复制所有流.
推荐答案
显然,这是一个很普遍的问题,所以我将解决方案作为答案发布(以前是评论答复),以便其他人可以看到.
Apparently this is a popular question, so I'm posting my solution as an answer (was previously a comment reply) so that others can see.
我设法从此 ticket 中找到了正确的语法.正确的语法是:
I managed to find the correct syntax from this ticket. The correct syntax is:
ffmpeg -i in.mp4 -vcodec copy -c:a copy -map 0:0 -map 0:1 -map 0:2 out.mp4
这将复制所有3个流.
这篇关于FFmpeg不复制所有音频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!