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

Geschlossen
Veröffentlicht vor mehr als 5 Jahren

$30-250 USD

Bezahlt bei Lieferung
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]
Projekt-ID: 18397088

Über das Projekt

2 Vorschläge
Remote Projekt
Aktiv vor 5 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten
2 Freelancer bieten im Durchschnitt $93 USD für diesen Auftrag
Avatar des Nutzers
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 in 3 Tagen
5,0 (2 Bewertungen)
4,2
4,2
Avatar des Nutzers
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 in 1 Tag
4,9 (31 Bewertungen)
4,3
4,3

Über den Kunden

Flagge von NORWAY
Oslo, Norway
5,0
1
Zahlungsmethode verifiziert
Mitglied seit Dez. 20, 2016

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.