ffmpeg的流偏移命令(-itsoffset)不工作 [英] ffmpeg stream offset command (-itsoffset) not working

查看:1098
本文介绍了ffmpeg的流偏移命令(-itsoffset)不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的AP preciate,如果有人能够给出关于使用itsoffset与ffmpeg的一些指点。我读了一些职位在这个问题上,他们中的一些解释很清楚如何与-itsoffset重新同步音频和视频,但我还没有能够使它发挥作用。
我的AVI文件是带的ffmpeg codeD,分两道,使用下面的命令,第二道:

I would really appreciate if someone could give some pointers regarding the use of itsoffset with ffmpeg. I have read a number of posts on this subject, some of them explain very clearly how to re-synchronize audio and video with -itsoffset, but I haven't been able to make it work. My avi file is encoded with ffmpeg, in two passes, using the following command for the second pass:

ffmpeg -i whole-vts_01.avs -pass 2 -y -vcodec libxvid -vtag XVID -b:v 1300K -g 240 -trellis 2 -mbd rd -flags +mv4+aic -acodec ac3 -ac 2 -ar 48000 -b:a 128k output.avi

无论出于何种原因,我结束了在视频中的1秒的延迟(或音频为1秒早期)。这不会经常发生,但我看到它不时。
在其他的尝试,我已经试过如下:

For whatever reason, I end up with a 1 sec delay in the video (or the audio is 1 sec early). It doesn't happen too often but I see it from time to time. Among other attempts, I have tried the following:

(1) ffmpeg -i output.avi -itsoffset 00:00:01.0 -i output.avi -vcodec copy -acodec copy -map 0:0 -map 1:1 output-resynched.avi
(2) ffmpeg -i output.avi -itsoffset 00:00:01.0 -i output.ac3 -vcodec copy -acodec copy -map 0:0 -map 1:0 output-resynched2.avi
(3) ffmpeg -itsoffset -00:00:01.00 -i output.avi output-resynched8.avi
(4) ffmpeg -i output.avi -itsoffset -1.0 -i output.avi -vcodec copy -acodec copy -map 0:1 -map 1:0 output-resynched13.avi

下面是结果:


  1. 音频乱码只有5m 35秒长与1H41米。

  2. (Output.ac3是output.avi的音频组件)视频和音频
    等同于原来,偏移没有工作

  3. 音频没有得到转移,但是默认的替换原有的编码参数(如预期)。

  4. 音频乱码,只有9米56S长与1H41米。

我看到不少人解释,显然使用上面描述的过程,但它似乎并没有为我工作。我失去了一些东西明显?我非常希望能够用-itsoffset因为它比我的解决方法解决方案清洁。

I see that many people explain, and apparently use the process described above, but it doesn't seem to be working for me. Am I missing something obvious? I would very much like to be able to use -itsoffset as it is cleaner than my workaround solution.

FWIW,这里是得到期望结果的不同,和较长的方式:

FWIW, here is a different, and longer way of obtaining the desired result:

首先创建一个移动视频仅使用-ss文件:

First create a shifted video only file using -ss:

ffmpeg -i output.avi -ss 1.0 -vcodec copy -an oupput_videoshifted.avi

然后提取音频:

ffmpeg -i output.avi -vn -acodec copy outputaudioonly.ac3

最后REMUX两个组成部分:

And finally remux both components:

ffmpeg -i output_videoshifted.avi -i output_audioonly.ac3 -vcodec copy -acodec copy -map 0:0 -map 1:0 output-resynched14.avi

该过程的工作,是速度不够快,但我真的preFER使用一个通过-itsoffset解决方案。

The process works, is fast enough, but I would really prefer to use the one pass -itsoffset solution.

推荐答案

下面是我做的,它为我工作

Here is what I did and it work for me

第一输入设定-i和第二输入是来自相同的一个视频文件。

The first input setting -i and the second input is come from the same one video file.

延迟1秒第一个输入视频和第二输入音频只是做一个副本

Delay 1 second in first input video and the second input audio just make a copy

ffmpeg -y -itsoffset 00:00:01.000 -i "d:\Video1.mp4" -i "d:\Video1.mp4"
 -map 0:v -map 1:a -vcodec copy -acodec copy
 -f mp4 -threads 2 -v warning "Video2.mp4"

延迟1秒在第二输入音频和第一输入视频只是做一个副本

Delay 1 second in second input audio and the first input video just make a copy

ffmpeg -y -i "d:\Video1.mp4" -itsoffset 00:00:01.000 -i "d:\Video1.mp4"
 -map 0:v -map 1:a -vcodec copy -acodec copy
 -f mp4 -threads 2 -v warning "Video2.mp4"

这篇关于ffmpeg的流偏移命令(-itsoffset)不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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