【发布时间】:2019-12-30 22:39:00
【问题描述】:
我想合并几个 mp4 视频(具有不同的 fps、高度、宽度和比特率)。
我尝试了一些视频,但它总是隐藏或跳过input.txt 中的一些视频文件。
如何正确合并这些 mp4 文件?
谢谢!
我的命令:
ffmpeg, "-f", "concat", "-i", "concatfile.txt", "-c:v", "copy", "-sn", "-y", "merged_video.mp4", "-max_muxing_queue_size", "1024"
->视频播放不正确
编辑: 我现在在concat.txt_中输出每个视频的信息_
INPUT1:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000028cdd7c3d00] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concatfile.txt':
Duration: N/A, start: 0.000000, bitrate: 535 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 435 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 05/10/2019.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 100 kb/s
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 05/10/2019.
INPUT2:
mov,mp4,m4a,3gp,3g2,mj2 @ 00000256592b3d00] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concatfile.txt':
Duration: N/A, start: 0.000000, bitrate: 620 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 522 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 97 kb/s
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
INPUT3:
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001a774cd3d00] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concatfile.txt':
Duration: N/A, start: 0.000000, bitrate: 609 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 513 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
INPUT4:
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000165b1013c80] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concatfile.txt':
Duration: N/A, start: 0.000000, bitrate: 510 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 415 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 10/31/2018.
INPUT5:
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001c545493c80] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concatfile.txt':
Duration: N/A, start: -0.042667, bitrate: 2972 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 900x600 [SAR 1:1 DAR 3:2], 2862 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 110 kb/s
Metadata:
handler_name : SoundHandler
可能是问题,最后一个 mp4 有单声道音频?
【问题讨论】:
-
所有输入必须具有相同的属性。要么通过过滤和重新编码使其他内容匹配主要内容,然后使用 concat demuxer,或者通过使用 concat 过滤器在一个命令中重新编码和连接所有内容(这里有几个 Q/A 显示如何做)。如果您需要更多帮助,请在edit 您的问题中包含
concatfile.txt中列出的每个输入的信息,例如运行ffmpeg -i input1.mp4 -i input2.mp4 -i input3.mp4并提供完整的日志。 -
感谢您的快速回复,我已经更新了有关您推荐的问题。