Page 2 of 5
Re: Audio not sync after encode.
Posted: Mon Oct 07, 2019 10:26 am
by emcodem
Mahmoud Rady wrote: ↑Sat Oct 05, 2019 3:31 pm
pcm_ s24le also gives the same result
To be honest, i think there is a good reason why ffmpeg delays the audio; i don't think you suffer from kind of a bug or so. Maybe your video pts just starts 2 frames before the first audio sample pts so ffmpeg inserts silent audio for the first 2 frames. There are lots of possibilities.
However, if you always have the same delay about 2 frames, you could possibly just use -itsoffset 0.08 to resync audio and video?
Re: Audio not sync after encode.
Posted: Thu Nov 21, 2019 4:26 pm
by Mahmoud Rady
Thanks emcodem, it says encoding failed after adding -itsoffset 0.0
-f mov -vcodec dvvideo -vtag dvcp -pix_fmt yuv420p -s 720x576 -b:v 25m -qscale 15 -acodec pcm_s24le -ac 2 -ar 48000 -itsoffset 0.40
Re: Audio not sync after encode.
Posted: Thu Nov 21, 2019 4:47 pm
by emcodem
Hey Mahmoud,
yeah, that is because itsoffset is an input option. I thought you might be able to google for this and use it in a commandline processor.
From your last post, i suspect that you are using custom ffmpeg processor, there you can play with -af adelay instead of itsoffset like this:
-f mov -vcodec dvvideo -vtag dvcp -pix_fmt yuv420p -s 720x576 -b:v 25m -qscale 15 -acodec pcm_s24le -ac 2 -ar 48000 -af adelay=delays=1920S
Re: Audio not sync after encode.
Posted: Wed May 27, 2020 8:15 pm
by Mahmoud Rady
Hi Emcodem, I really appriciate your help on this but I'm still couldn't fix it.
workflow with command line proccessor
- CMD 01.PNG (47.86 KiB) Viewed 9531 times
- CMD 02.PNG (26.32 KiB) Viewed 9531 times
workflow without CMD and the Params added in the bottom box but it gives an error on the H264 node.
- no CMD 01.PNG (50.99 KiB) Viewed 9531 times
Re: Audio not sync after encode.
Posted: Wed May 27, 2020 8:21 pm
by Mahmoud Rady
Output
source is in the upper audio track
FFAStrans output in the bottom audio track
- Output.PNG (11.18 KiB) Viewed 9530 times
Re: Audio not sync after encode.
Posted: Thu May 28, 2020 6:45 am
by emcodem
Hey Mahmoud,
it is great that you stick to that topic, keep it on, i am sure we can solve this.
You need to use a "Custom ffmpeg" processor instead of the h264 encoder node. There is no way we can make this work with the predefined h264.
in the custom ffmpeg's processor configuration you input this:
Code: Select all
-f mov -vcodec dvvideo -vtag dvcp -pix_fmt yuv420p -s 720x576 -b:v 25m -qscale 15 -acodec pcm_s24le -ac 2 -ar 48000 -af adelay=delays=1920S
let me know your results please!
Re: Audio not sync after encode.
Posted: Thu May 28, 2020 10:57 am
by Mahmoud Rady
Thanks for your reply... Here is the final output after adding -af adelay=delays=1920S
only the left channel in the last track has shiffted slightly to the right. I want them to be synced perfectly to the first track.
Re: Audio not sync after encode.
Posted: Sun May 31, 2020 8:17 am
by emcodem
Mahmoud Rady wrote: ↑Thu May 28, 2020 10:57 am
-af adelay=delays=1920S
Ah, correct, we do not want to delay the audio but shift it to the other direction.
Before i go on with shots in the dark, i would like to be able to reproduce your problem. Could you upload a short example file you are using to reproduce the problem please?
https://drive.google.com/drive/folders/ ... sp=sharing
Thanks!
Re: Audio not sync after encode.
Posted: Sun May 31, 2020 11:17 am
by Mahmoud Rady
Hi Emcodem, input and output sample have been uploaded.
- Capture.PNG (24.63 KiB) Viewed 9466 times
it's a slight shift but I want them perfectly in sync.
Re: Audio not sync after encode.
Posted: Tue Jun 02, 2020 4:45 am
by emcodem
Hi Mahmoud,
thanks for the files, they are just perfect samples for playing with this.
Unfortunately in my first try, i don't see the audio being shifted
My method is to first extract the audios from the files and save them to wav, e.g. this command:
ffmpeg -i "C:\Users\meme\Downloads\input_30 sec.mov" -vn "C:\Users\meme\Downloads\input.wav"
Then i compare the 2 wav files using audacity. What i see this way is perfect alignement.
- inputvsoutput.png (176.55 KiB) Viewed 9413 times
Also, when using some player that shows me the VU, i see exactly the same VU power in both files when i compare frame by frame. The thing that both of my measuring methods have in common is that it is always ffmpeg libraries that do the decoding.
Are you using different tools for measuring or are you using always the same tool (Permiere?)? ...different decoders might show different behaviour when decoding, especially when using delivery formats like mp4/mov/h264/aac.