Find Jobs
Hire Freelancers

FFMPEG: How to avoid audio/video desync in output of crossfaded clips when input is variable frame rate video

$30-250 USD

已关闭
已发布超过 5 年前

$30-250 USD

货到付款
Hi! I'm doing screen recordings of gameplay (Dota2) using my NVIDIA graphics card GeForce experience hardware recording (NVEC Encoder). This creates a variable frame rate output video. My NVIDIA settings are 60 fps 15000 kbps. I have paid a guy to make a program that generates scripts that given start/stop timepoints can extract clips from the video and merge them with crossfade. See example code below. The script works for many input recordings but fails often: The audio and video are desynchronized (usually audio delay) in many of the clips, ca 0.5 seconds. I think it fails more when frame rate dropped more during recording. He does not know how to fix the problem, and I wonder if anyone could point out if anything could be fixed in the script (example below)? Processing speed is quite important (now making a 10 min 'highlight' video takes ca 7-10 min). Solutions increasing that amount very much more is not of too big interest, unfortunately. His approach has been to work separately with audio and video and merge in the end. He already has a program to make ffmpeg code for working with different scenarios (also adding overlays, adding music, intro/outro) so it would be preferable with some easy fixes to his code and not dramatic redesigning of the logic. But if nothing else can fix the problem, a redesign in logic is ok. Using other tools than ffmpeg is also ok, but should be automatable (scripts/cli) and not increase processing times too much. Running the program "mediainfo" on the input video shows that framerate dropped quite low for this input video: Frame rate mode: Variable Frame rate : 60.000 FPS Minimum frame rate: 3.059 FPS Maximum frame rate: 63.739 FPS Full report here: [login to view URL] The input video can be downloaded from dropbox here (6 GB): [login to view URL] Here the example of a script when asked to extract two clips from input video at 9:57 (41 sec length) and 15:45 (28 sec length) and crossfade merge them with a 0.5 crossfade time. There might be some code-remnants from options that are not used in this example (overlays, music, intro/outro). Using the input video above, this creates audio/video desync. 6 commands excecuted in sequence: [login to view URL] -loglevel warning -ss 00:09:57 -i [login to view URL] -t 00:00:41 -filter_complex "[0:a]afade=t=out:st=40.5:d=0.5[a1]" -map "[a1]" -y [login to view URL] [login to view URL] -loglevel warning -i [login to view URL] -ss 00:09:57 -t 00:00:41 -an -vcodec copy -f mpegts -avoid_negative_ts make_zero -y [login to view URL] [login to view URL] -loglevel warning -ss 00:15:45 -i [login to view URL] -t 00:00:28 -filter_complex "[0:a]afade=t=in:st=0:d=0.5[a1]" -map "[a1]" -y [login to view URL] [login to view URL] -loglevel warning -i [login to view URL] -ss 00:15:45 -t 00:00:28 -an -vcodec copy -f mpegts -avoid_negative_ts make_zero -y [login to view URL] [login to view URL] -loglevel warning -i [login to view URL] -i [login to view URL] -y -filter_complex "[0:a]adelay=0|0[a0];[1:a]adelay=40500|40500[a1];[a0][a1]amix=inputs=2:dropout_transition=68.5,atrim=duration=68.5[outa0];[outa0]loudnorm[outa]" -map "[outa]" -ar 48000 -acodec aac -strict -2 [login to view URL] [login to view URL] -loglevel warning -i [login to view URL] -i [login to view URL] -y -i [login to view URL] -filter_complex "[0:v]trim=start=0.5,setpts=PTS-STARTPTS[0c];[1:v]trim=start=0.5,setpts=PTS-STARTPTS[1c];[0:v]trim=40.5:41,setpts=PTS-STARTPTS[fo];[1:v]trim=0:0.5[fi];[fi]format=pix_fmts=yuva420p,fade=t=in:st=0:d=0.5:alpha=1[z];[fo]format=pix_fmts=yuva420p,fade=t=out:st=0:d=0.5:alpha=1[x];[z]fifo[w];[x]fifo[q];[q][w]overlay[r];[0c][r][1c]concat=n=3[outv]" -map "[outv]" -map 2:a -shortest -acodec copy -vcodec libx264 -preset ultrafast -b 15000k -aspect 1920:1080 [login to view URL] P.S. I already asked for help at an ffmpeg chat room. One guy said he knew what the problem was, but didnt know how to fix it(?): [login to view URL]
项目 ID: 18397088

关于此项目

2提案
远程项目
活跃5 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
2威客以平均价$93 USD来参与此工作竞价
用户头像
Hello Sir. I am a software architecture and web developer with a Bachelor of Science in Information Technology from Tsinghua University and 7 years of software development experience. I am experienced in web development with site building technologies using WordPress and CodeIgniter framework, and I have the ios and android app development technologies perfectly. I have a working experience with MVC. I have also designed and developed web user controls, master pages, validation controls, CSS files using technologies like AJAX Toolkit, jQuery, JavaScript, XML HTML, and DHTML. Additionally, I have written a lot of project for Android and iOS app. When working on a new project, I like to speak with my clients so that I can have a clear understanding of their needs and vision of the project. Thank you in advance for your time and consideration. I look forward to working with you soon.
$155 USD 在3天之内
5.0 (2条评论)
4.2
4.2
用户头像
I would not use stream copy neither. And perhaps converting the video to a constant frame rate one (with -crf 0, -r 60) before anything else would be helpful to solve the problem. But it is just after a quick look on the problem.
$30 USD 在1天之内
4.9 (31条评论)
4.3
4.3

关于客户

NORWAY的国旗
Oslo, Norway
5.0
1
付款方式已验证
会员自12月 20, 2016起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。