FFMPEG -F Concat视频,音频Sycn问题 [英] FFMPEG -F Concat Video, Audio Sycn Issue

查看:427
本文介绍了FFMPEG -F Concat视频,音频Sycn问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题,连结视频,它丢失了从以前的视频开始的音频同步和音频。



我已经尝试下面两个链接/所以Mulvya的答案,但没有一个工作:(



这是我正在尝试的代码:



1:编码文件a(1):

  ffmpeg.exe -if:\1.avi-af apad -vf scale = 1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags + genpts 01.mp4 

2:重新编码文件b(2):

  ffmpeg.exe -if:\2.mp4-af apad -vf scale = 1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:一个192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags + genpts 02.mp4 

3:现在联系使用以下命令:

  ffmpeg.exe -f concat -safe 0 -if:\files.txt -c copy test.mp4 

但音频未与视频同步;(



<我也上传了两个视频(和输出)在保管箱:



视频同步问题来源和结果文件



所以,任何帮助,如何使音频与视频完美同步将是巨大的:)

解决方案

一些其他解决方案同步音频和;视频



在您的输入文件中使用 -bsf:v h264_mp4toannexb

  ffmpeg.exe -i1.avi-af apad -vf scale = 1280:720 -crf 15.0 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags + genpts output1.flv 

和第二个文件相同

  ffmpeg.exe -i2.avi-af apad -vf scale = 1280:720 -crf 15.0 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags + genpts output2.flv 

然后文件可以连接在一起

  ffmpeg -f concat -safe 0 -i concat.txt -c copy -bsf:a aac_adtstoasc final.flv 

其中concat.txt文件包含

 文件'output1.flv'
文件' output2.flv'


i am having issue, to concat video, it looses the audio sync and audio started from previous video.

i have tried below two link/so answer by Mulvya, but none of them work :(

here is the code i am trying:

1: re-encode file a (1):

ffmpeg.exe -i "f:\1.avi" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts 01.mp4

2: re-encode file b (2):

ffmpeg.exe -i "f:\2.mp4" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts 02.mp4

3: Now contact using following command:

ffmpeg.exe -f concat -safe 0 -i "f:\files.txt" -c copy test.mp4

but audio is not synced with video ;(

i also uploaded both video (and also the output) on dropbox:

Video Sync Issue Source And Result Files

so, any help, how to make audio perfectly sync with video would be great :)

解决方案

some other solution for syncing audio & video

use -bsf:v h264_mp4toannexb in your input files

ffmpeg.exe -i "1.avi" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts output1.flv

and same for 2nd file

ffmpeg.exe -i "2.avi" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts output2.flv

then files can be joined together

ffmpeg -f concat -safe 0 -i concat.txt -c copy -bsf:a aac_adtstoasc final.flv

where concat.txt file contains

file 'output1.flv'
file 'output2.flv'

这篇关于FFMPEG -F Concat视频,音频Sycn问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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