Video/audio sync issue

229 views
Skip to first unread message

Curt Lundgren

unread,
Sep 19, 2023, 7:35:23 PM9/19/23
to NLUG
My brother sent me an MP4 file, about 900 MB, where the audio is at least a second ahead of video.  I'd like to process the file so lip sync is proper, but my search engine fu is coming up short.  ffmpeg seems like it would have the capability, but I haven't found a clue in the documentation or the man page.

The video does not need to be changed in any way, but if possible, I'd like to boost the audio gain by as much as 10 db.

I'd prefer to do this on a Linux machine, something running from command line would be ideal.  Does anyone have a clue how this can be accomplished?

Thanks
Curt Lundgren

Gibson Prichard

unread,
Sep 19, 2023, 7:51:17 PM9/19/23
to nlug...@googlegroups.com
As someone who works in TV, my initial response is to adjust it in VLC on playback, but that won't save the file with the corrected audio; only play it corrected. You could open the file in a video editor, Like Davinci Resolve on Linux and slide the audio track. However, this will almost certainly cause the whole video to be re-saved and re-encoded when you save the file, which will affect the video quality. Similarly, you may be able to use Avidemux (https://avidemux.sourceforge.net/download.html) to adjust the lipsync. See https://www.simplehelp.net/2018/05/29/how-to-fix-out-of-sync-audio-video-in-an-mkv-mp4-or-avi/ for a tutorial.

Gibson Prichard
Nashville, TN



--
--
You received this message because you are subscribed to the Google Groups "NLUG" group.
To post to this group, send email to nlug...@googlegroups.com
To unsubscribe from this group, send email to nlug-talk+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en

---
You received this message because you are subscribed to the Google Groups "NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nlug-talk+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nlug-talk/CADPPtrp%3Dqnd%3DzFSQXAxjNfPQfZALp1RaXve0tpgt0fCsVTxhiA%40mail.gmail.com.

Michael L

unread,
Sep 19, 2023, 10:31:51 PM9/19/23
to nlug...@googlegroups.com
I do video editing as part of my job.  
Suggestion #1:  The Shotcut video editor allows you to separate the audio from video and add audio delay by moving the audio down the timeline from the video by 1 frame at a time or more.  That's a tough and potentially time consuming way to get it exact, but maybe you can fix it that way and re render / export the file.

I'll search for another way with FFMPEG and let you know if I find it .. along with other info.

On Tue, Sep 19, 2023 at 6:35 PM Curt Lundgren <veri...@gmail.com> wrote:
--

Curt Lundgren

unread,
Sep 19, 2023, 10:48:23 PM9/19/23
to nlug...@googlegroups.com, Michael L
Thanks very much Gibson, the avidemux software worked perfectly.  Also thank you @Michael L, it is much appreciated.

Michael L

unread,
Sep 19, 2023, 10:49:52 PM9/19/23
to nlug...@googlegroups.com
This is if you happen to know how far off the audio is from the video in this case 3840 milliseconds or 3.84 seconds

ffmpeg -i "movie.mp4" -itsoffset 3.84 -i "movie.mp4" -map 1:v -map 0:a -c copy "movie-video-delayed.mp4"
Found this here: https://superuser.com/questions/982342/in-ffmpeg-how-to-delay-only-the-audio-of-a-mp4-video-without-converting-the-au

The hard part is knowing how far out of sync the audio is from the video, but it's a quick change of the command line to experiment.

I generally like to avoid re-encoding the video as Gibson mentioned.  Assuming you're not doing cinematography, a re-encode may give you more options.

Vincent Brown

unread,
Oct 4, 2023, 4:29:19 PM10/4/23
to NLUG
Would any of you guys that are experienced at editing video & sound in Linux consider doing some demos for an upcoming meeting. Doesn't necessarily have to be next week's meeting. This would make a great topic!

Michael L

unread,
Oct 4, 2023, 5:57:48 PM10/4/23
to nlug...@googlegroups.com
I'm up for it, after this coming Tuesday 

Paul Boniol

unread,
Oct 4, 2023, 8:23:00 PM10/4/23
to nlug...@googlegroups.com
Definitely interested.

One of the things I commonly do is take a video and cut out a few minutes here and there. I'd love to have a way to do that (visually) without having to reencode the entire video on output, but from my limited searching, I haven't seen any software that does that.  Maybe there is a technical reason that isn't even possible. (Yes, I know it may have to create a new key frame at the beginning of a cut but the entire video?)

I've been using Kdenlive. It suffices, but figuring out parameters if you want more control over the rendered output than "I want an mp4" is much more difficult than it should be. (And at least one documented option throws a big warning "this probably doesn't do what you think it does" if I try to use it. And I still don't understand why the default value specified isn't the value you see, or get... Just been living with it.)

Michael L

unread,
Oct 4, 2023, 9:17:27 PM10/4/23
to nlug...@googlegroups.com
According to the video encoding experts at Wolfram Research, mp4 footage always has to be re-encoded, not the case with MPEG2

I also found Kdenlive to be less than easy to use in the rendering area.

Justin W Elam

unread,
Oct 4, 2023, 11:33:52 PM10/4/23
to nlug...@googlegroups.com
Hello

Apparently I am showing my age.

The last time I cut and spliced video it was on to a blank VHS tape

With an analogue VHS mixer and editor

At real time speed.

And sometimes it took a long time to get the video on the VHS correct.


At least now with software editing it appears to be less time consuming than it used to take.


Cheers from Justin 
Reply all
Reply to author
Forward
0 new messages