ffmpeg在输出上将start_time设置为负值 [英] ffmpeg is setting start_time to a negative value on output

查看:140
本文介绍了ffmpeg在输出上将start_time设置为负值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我们一直在使用ffmpeg的旧版本,现在我们需要升级到最新版本(例如2.6),并且在将.mov转换为.mp4时遇到问题.

例如,我有一个.mov视频文件,该文件包含两个流,即视频和音频,都具有start_time = 0,并且在使用以下方式进行转换时:

ffmpeg -i my_file.mov my_file.mp4

输出mp4的音频流的开始时间为start_time = -0.021333.

FORMAT部分,如ffprobe -show_format -show_streams my_file.mp4所示也有start_time = -0.021333

我们使用的ffmpeg的先前版本没有此问题...

当我们使用<在网络浏览器中播放输出的mp4文件时.video>播放时一切都很好,但是如果我们暂停视频并到处寻找,我们会注意到所有帧都被关闭了1.第一帧被复制,最后一帧丢失!>

换句话说:

  dom.currentTime = 0显示第一帧dom.currentTime = 1/24(fps为24)再次显示第一帧dom.currentTime = 2/24显示第二帧而不是第三帧dom.currentTime = 3/24显示第三帧而不是第四帧... 

我们认为这是由字段start_time = -0.021333

引起的

这对我们来说是一个主要问题...

它是chrome和firefox的复制版,但是Safari对此没有任何问题...

在对此进行了搜索之后,我们发现我们不是唯一遇到此问题的人,但是目前尚不清楚解决方案是什么.

有人建议使用"-c:一个副本"参数,它在某些文件上有效,但在另一些文件上却给出了错误:

无法为输出文件#0写入标题(编解码器参数不正确?):参数无效

所以这似乎不是一个可靠的解决方案...

任何帮助将不胜感激.

解决方案

您可以尝试完全避免出现负面TS

  ffmpeg -i my_file.mov -avoid_negative_ts make_zero my_file.mp4 


使用您的输入文件,我运行了该命令,

  ffmpeg -i AnimalTrancoding_v001_Shot0020.mov out.mp4 

在输出上运行ffprobe,

  ffprobe -show_entries format = start_time:stream = start_time -of compact out.mp4 

我知道

  stream | start_time = 0.000000流| start_time = 0.000000流|开始时间= 0.000000格式| start_time = 0.000000 

前几帧的比较没有显示出相对于源的任何重复或掉落.

我正在运行最近的每晚构建(2016年5月).

We've been using an old version of ffmpeg for a while and now we need to upgrade to a more recent version (e.g. 2.6) and we have issues with it while converting .mov to .mp4.

For instance I have a .mov video file that has two streams, video and audio, both with start_time=0 and when I convert it using:

ffmpeg -i my_file.mov my_file.mp4

the output mp4 has an audio stream with start_time=-0.021333.

The FORMAT section, as shown by ffprobe -show_format -show_streams my_file.mp4 also has start_time=-0.021333

The previous version of ffmpeg we were using didn't have this issue...

When we play the output mp4 file in a web browser using < video > it's all good while playing but if we pause the video and seek here and there we notice that all the frames are off by 1. The first frame is duplicated and the last frame is missing!

In other words:

dom.currentTime = 0 shows the first frame
dom.currentTime = 1/24 (fps is 24) shows the first frame again
dom.currentTime = 2/24 shows the second frame instead of the third frame
dom.currentTime = 3/24 shows the third frame instead of the fourth frame
...

We believe this is caused by the field start_time=-0.021333

This is a major issue for us...

It's repro on chrome and firefox but somehow safari is not having issues with this...

After googling this we found that we're not the only one with this issue but it's not clear what the solution is.

Someone suggested to use the "-c:a copy" arguments and it worked on some files but gave an error on some others:

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

So this doesn't seem to be a robust solution...

Any help would be appreciated.

解决方案

You can try to avoid negative TS altogether

ffmpeg -i my_file.mov -avoid_negative_ts make_zero my_file.mp4


With your input file, I ran this command,

ffmpeg -i AnimalTrancoding_v001_Shot0020.mov out.mp4

Rrunning ffprobe on the output,

 ffprobe -show_entries format=start_time:stream=start_time -of compact out.mp4

I see

stream|start_time=0.000000
stream|start_time=0.000000
stream|start_time=0.000000
format|start_time=0.000000

A comparison the first few frames didn't show any duplication or drops with respect to the source.

I'm running a recent nightly build (May 2016).

这篇关于ffmpeg在输出上将start_time设置为负值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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