使用FFmpeg连接四个MP4视频文件

使用FFmpeg连接四个MP4视频文件,ffmpeg,mp4,h.264,Ffmpeg,Mp4,H.264,我正在尝试使用FFmpeg连接四个MP4视频文件。(最新版本)这四个mp4视频不同于一般mp4视频,并且有特定的编解码器,我在K-Lite Mega Codec Pack 13.1.0的帮助下在Windows Media Player中播放它们 MediaInfo提供的一个文件的编解码器信息(所有四个文件都有相同的编解码器): 概述 Complete name : Testing - 1.mp4 Format : MPEG-4

我正在尝试使用FFmpeg连接四个MP4视频文件。(最新版本)这四个mp4视频不同于一般mp4视频,并且有特定的编解码器,我在K-Lite Mega Codec Pack 13.1.0的帮助下在Windows Media Player中播放它们

MediaInfo提供的一个文件的编解码器信息(所有四个文件都有相同的编解码器):

概述

Complete name               : Testing - 1.mp4
Format                      : MPEG-4
Format profile              : Base Media
Codec ID                    : isom (mp41/avc1)
File size                   : 59.4 MiB
Duration                    : 3 min 47 s
Overall bit rate mode       : Variable
Overall bit rate            : 2 196 kb/s
Writing application         : vlc 2.2.4 stream output
Comment                     : QuickTime 6.0 or greater
ID                          : 2
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L3
Format settings, CABAC      : Yes
Format settings, ReFrames   : 3 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 3 min 47 s
Bit rate mode               : Constant
Bit rate                    : 2 000 kb/s
Width                       : 720 pixels
Height                      : 576 pixels
Display aspect ratio        : 5:4
Frame rate mode             : Constant
Frame rate                  : 25.000 FPS
Standard                    : PAL
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.193
Stream size                 : 54.1 MiB (91%)
ID                          : 1
Format                      : AAC
Format/Info                 : Advanced Audio Codec
Format profile              : LC
Codec ID                    : 40
Duration                    : 3 min 47 s
Source duration             : 3 min 46 s
Bit rate mode               : Variable
Bit rate                    : 192 kb/s
Maximum bit rate            : 294 kb/s
Channel(s)                  : 2 channels
Channel positions           : Front: L R
Sampling rate               : 48.0 kHz
Frame rate                  : 46.875 FPS (1024 spf)
Compression mode            : Lossy
Stream size                 : 5.13 MiB (9%)
Source stream size          : 5.13 MiB (9%)
视频

Complete name               : Testing - 1.mp4
Format                      : MPEG-4
Format profile              : Base Media
Codec ID                    : isom (mp41/avc1)
File size                   : 59.4 MiB
Duration                    : 3 min 47 s
Overall bit rate mode       : Variable
Overall bit rate            : 2 196 kb/s
Writing application         : vlc 2.2.4 stream output
Comment                     : QuickTime 6.0 or greater
ID                          : 2
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L3
Format settings, CABAC      : Yes
Format settings, ReFrames   : 3 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 3 min 47 s
Bit rate mode               : Constant
Bit rate                    : 2 000 kb/s
Width                       : 720 pixels
Height                      : 576 pixels
Display aspect ratio        : 5:4
Frame rate mode             : Constant
Frame rate                  : 25.000 FPS
Standard                    : PAL
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.193
Stream size                 : 54.1 MiB (91%)
ID                          : 1
Format                      : AAC
Format/Info                 : Advanced Audio Codec
Format profile              : LC
Codec ID                    : 40
Duration                    : 3 min 47 s
Source duration             : 3 min 46 s
Bit rate mode               : Variable
Bit rate                    : 192 kb/s
Maximum bit rate            : 294 kb/s
Channel(s)                  : 2 channels
Channel positions           : Front: L R
Sampling rate               : 48.0 kHz
Frame rate                  : 46.875 FPS (1024 spf)
Compression mode            : Lossy
Stream size                 : 5.13 MiB (9%)
Source stream size          : 5.13 MiB (9%)
音频

Complete name               : Testing - 1.mp4
Format                      : MPEG-4
Format profile              : Base Media
Codec ID                    : isom (mp41/avc1)
File size                   : 59.4 MiB
Duration                    : 3 min 47 s
Overall bit rate mode       : Variable
Overall bit rate            : 2 196 kb/s
Writing application         : vlc 2.2.4 stream output
Comment                     : QuickTime 6.0 or greater
ID                          : 2
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L3
Format settings, CABAC      : Yes
Format settings, ReFrames   : 3 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 3 min 47 s
Bit rate mode               : Constant
Bit rate                    : 2 000 kb/s
Width                       : 720 pixels
Height                      : 576 pixels
Display aspect ratio        : 5:4
Frame rate mode             : Constant
Frame rate                  : 25.000 FPS
Standard                    : PAL
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.193
Stream size                 : 54.1 MiB (91%)
ID                          : 1
Format                      : AAC
Format/Info                 : Advanced Audio Codec
Format profile              : LC
Codec ID                    : 40
Duration                    : 3 min 47 s
Source duration             : 3 min 46 s
Bit rate mode               : Variable
Bit rate                    : 192 kb/s
Maximum bit rate            : 294 kb/s
Channel(s)                  : 2 channels
Channel positions           : Front: L R
Sampling rate               : 48.0 kHz
Frame rate                  : 46.875 FPS (1024 spf)
Compression mode            : Lossy
Stream size                 : 5.13 MiB (9%)
Source stream size          : 5.13 MiB (9%)
要连接的MP4视频文件有“Testing-1.MP4”、“Testing-2.MP4”、“Testing-3.MP4”和“Testing-4.MP4”

我需要使用FFmpeg的连接方法将这四个MP4文件连接到一个MP4文件中

首次尝试(使用Concat解复用器):

文件连接成一个MP4文件,其中包含来自FFmpeg的多个错误和警告

输出流中的非单调DTS

SPS NALU丢失或无效,结果流可能无法播放

使用Windows Media Player播放上述连接的文件时,会出现错误

网络太忙,无法以原始质量播放文件

但是文件实际上在本地硬盘上

Seek选项不工作(即使在VLC媒体播放器中),Windows资源管理器显示的持续时间不正确,如3小时54分钟,应为15分钟05秒

第二次尝试(使用Concat解复用器):

然后文件成功连接并在Windows Media Player和VLC Media Player中播放,无任何错误。这里唯一的问题是文件非常大,大小约为1.2GB,因为恒定速率因子设置为0以阻止WMP网络相关错误

注意:在连接之前(四个源文件)在两个播放器中都可以正常播放,没有任何错误,但它们的大小也是中等的。正如MediaInfo显示的,“Testing-1.mp4”是59.4MB,而不是巨大的大小

当我使用EasiestSoft Video/Audio Joiner 4.7加入其中时,该文件在播放时不会产生任何错误(我的意思是,一切正常,但我需要像FFmpeg这样的命令行工具来批处理多个视频),但在5.0版中,它似乎会产生与网络相关的错误(这可能是一个程序错误,我想它会重新编码,即使我选中了“不重新编码”复选框)


如何使用FFmpeg使这个连接的MP4文件更小(大约四个源文件的总大小)并使其能够在两个播放器中播放,而不会出现任何与网络相关的问题或不正确的持续时间问题。

请删除
-c copy
,改为对文件进行转码。您需要设置编码参数。@aergistal我在第二次尝试后也删除了它,但我无法确定此处真正需要的编码设置:-(您的第二次尝试也会复制音频/视频编码,而不是转码。由于您有H.264和AAC,请参阅,我将再次尝试,并通知您发生了什么情况。让我们。