MP4Box:即使样本描述不匹配,也连接轨道 ID 1 [英] MP4Box: Concatenating track ID 1 even though sample descriptions do not match

查看:46
本文介绍了MP4Box:即使样本描述不匹配,也连接轨道 ID 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本质上,我希望使用 MP4Box 连接一系列视频.当我尝试这样做时,我收到以下错误:

Essentially, I wish to concatenate a series of videos using MP4Box. When I attempt to do so, I receive the following error:

No suitable destination track found - creating new one (type soun)
0.500 secs Interleaving 

通过向 MP4Box 命令添加一个 -force-cat 参数,我可以至少暂时避免这个问题.但是,这会导致音频和视频的对齐问题并产生以下警告:

I can circumvent the issue, at least temporarily, by adding a -force-cat parameter to the MP4Box command. However, this creates issues with the alignment of audio and video and produces the following warning:

Concatenating track ID 1 even though sample descriptions do not match

现在,据我所知,这与视频类型之间的不同参数有关.我将在下面显示每种视频类型的 ffprobe 输出,以期对这个问题有所了解.

Now, as far as I can tell, this has to do with differing parameters between video types. I will display the ffprobe output of each video type below in order to hopefully shed some light on the issue.

视频类型 1 FFPROBE 输出:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '0.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:02.25, start: 0.000000, bitrate: 851 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 816 kb/s, 4 fps, 4 tbr, 16384 tbn, 8 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 32 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

视频类型 2 FFPROBE 输出:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'static.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.78.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 662 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 654 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler

谁能找出视频类型之间的不一致之处,以及我该如何解决?谢谢.

Can anyone identify what the incongruity between video types is and how I can resolve it? Thanks.

推荐答案

问题

文件属性必须匹配,但它们是不同的.请参阅必须匹配才能正确串联的属性列表.

重要的不一致:

  • H.264 配置文件(高与受限基线)
  • 时基(16384 tbn vs 30k tbn)
  • 一个有音频,另一个没有

如果您需要在长视频中添加短片段,此方法很好.它将保持长视频不变,因此将保持质量并且速度很快.缺点是您必须确保所有属性匹配,如果您不熟悉此主题,这可能会很困难.

This method is good if you need to add a short segment to a long video. It will leave the long video untouched and therefore will preserve the quality and it will be fast. Downside is that you have to make sure all of the attributes match which can be difficult if you are unfamiliar with this topic.

使用 static.mp4 像 0.mp4 的示例rel="nofollow noreferrer">anullsrc 过滤器以生成空白/静音/虚拟/填充音频.

Example to make static.mp4 like 0.mp4, using anullsrc filter to generate blank/silent/dummy/filler audio.

  1. 重新编码:

  1. Re-encode:

ffmpeg -i static.mp4 -f lavfi -i anullsrc=channel_layout=mono:sample_rate=24000 -c:v libx264 -c:a libmp3lame -video_track_timescale 16384 -shortest 1.mp4

  • 使 input.txt 包含:

    file '0.mp4'
    file '1.mp4'
    

  • 与 concat 分离器连接:

  • Concatenate with the concat demuxer:

    ffmpeg -f concat -i input.txt -c copy output.mp4
    

  • 解决方案 2:重新编码所有内容

    此方法使用多个过滤器使所有输入符合一组通用参数(帧速率、宽度、高度等).如果您的输入总是变化的或任意的,这是最有用的.它在一个命令中完成所有事情.缺点是它会重新编码所有内容并且可能会很慢.

    Solution 2: Re-encode everything

    This method uses multiple filters to conform all of the inputs to a common set of parameters (frame rate, width, height, etc). This is most useful if your inputs are always varied or arbitrary. It does everything in one command. Downside is that it re-encodes everything and might be slow.

    请参阅如何在 ffmpeg 中连接具有不同属性的视频? 中的许多示例.

    See How to concatenate videos in ffmpeg with different attributes? for many examples.

    这篇关于MP4Box:即使样本描述不匹配,也连接轨道 ID 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆