如何在不重新编码的情况下合并视频和音频?

问题描述 投票:0回答:1

有2个文件:

General
Complete name                            : D:\TEMP\videofile.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (avc1/mp42/dash)
File size                                : 5.93 GiB
Duration                                 : 1 h 49 min
Overall bit rate                         : 7 776 kb/s

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=4, N=50
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 h 49 min
Bit rate                                 : 7 773 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.150
Stream size                              : 5.93 GiB (100%)
Title                                    : Anvato eDASH 2.1
Codec configuration box                  : avcC

Text #1
ID                                       : 1-CC1
Format                                   : EIA-608
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 1 h 49 min
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)
CaptionServiceName                       : CC1

Text #2
ID                                       : 1-CC4
Format                                   : EIA-608
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 1 h 49 min
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)
CaptionServiceName                       : CC4

音频文件 Mediainfo:https://pastebin.com/Sn0rBAXg(移至 Pastebin,因为 SOF 不允许在问题中使用“这么多代码”)。

当我在 PotPlayer 中打开它们时 - 我可以观看视频(不过,它打开的时间很长,长达 40 秒)。但我想将这2个文件合并为1个,我尝试使用ffmpeg:

ffmpeg.exe -i videofile.mp4 -i audiofile.mp4 -map 0:v -map 1:a -c copy -y output.mp4

它生成的视频只有 33 分钟长。如何在不重新编码的情况下合并这些视频和音频?

audio video ffmpeg mp4 codec
1个回答
0
投票

concat 解复用器将合并视频和音频而无需重新编码。

按以下格式创建文本文件名

frames.txt

file '/path/to/v1.mp4'
file '/path/to/v2.mp4'
file '/path/to/v3.mp4'

然后使用以下命令:

ffmpeg -f concat -safe 0 -i frames.txt -c copy out.mp4

文件将按照它们在frames.txt中出现的顺序流式复制到out.mp4中。

注意:“复制编解码器”速度非常快。

© www.soinside.com 2019 - 2024. All rights reserved.