MP4 moof片段标题 [英] MP4 moof fragment headers

查看:985
本文介绍了MP4 moof片段标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MP4解析器软件,它是一个零碎的 .mp4 视频,解析 MOOV 和片段标题,流它。我已经使用 FFMPEG MP4Box .mp4 > / bento4 ,但是处理它的软件有问题。

  ffmpeg -i input.mp4 -g 25 -c:v libx264 -c:a copy out1.mp4 

mp4fragment out1.mp4 - 片段持续时间1000 --track'video'output.mp4

使用 MP4资源管理器软件,我发现在我生成的 .mp4 文件中,对于所有 moof.traf.trun ,采样持续时间设置为 0 ,但在跟踪片段标题框中,它设置 default_sample_duration 到512.在另一个 .mp4 文件中,没有 default_sample_duration 字段,但是每个单个样本的持续时间大小为512.看起来这可能会导致问题。右图显示了工作mp4,左边是我生成的mp4。



这是在较新版本的 FFMPEG (或 MP4Box bento4 )?有没有办法强制设置样品中的样品持续时间?




解析方法


  1. 解析TFHB

  2. 提取default_sample_duration

  3. 使用default_sample_duration而不是TRUN的缺席时间


I have a MP4 parser software that get's a fragmented .mp4 video, parses the MOOV and fragment headers and streams it. I have generated a .mp4 file myself using FFMPEG and MP4Box/bento4, but the software has problems processing it.

ffmpeg -i input.mp4 -g 25 -c:v libx264 -c:a copy out1.mp4

mp4fragment out1.mp4 --fragment-duration 1000 --track 'video' output.mp4

Using the MP4 Explorer software, I noticed in my generated .mp4 file, for all moof.traf.trun, sample duration is set to 0, but in the Track Fragment Header box, it sets the default_sample_duration to 512. While in the another .mp4 file which works fine, there is no default_sample_duration field, but each individual sample has a duration of size 512. Looks like this might cause the problem. The right figure shows the working mp4, and the left one is my generated mp4.

Is this an update in the newer versions of FFMPEG (or MP4Box or bento4)? Is there any ways to force setting the sample duration in samples?

My .mp4 file

The working .mp4 file

解决方案

  1. parse the TFHB
  2. extract the default_sample_duration
  3. use the default_sample_duration instead of the absent duration from TRUN

这篇关于MP4 moof片段标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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