Audio out of sync when rendering MP4s
Hello Cinelerra GG developers, I've found a strange behaviour in this great editing software. When I render my project, sometimes the audio is out of sync. Not all the audio, but from a certain point, from half of the video the audio is out of sync and it gets worst the more we get to the end of the video. It's like latency piles up. I've only done MP4 renderings so far. My idea, but I don't know how to demonstrate it, is that ffmpeg doesn't know how to render audio and video in sync, when there's some audio that is not aligned on frames. Since I do a lot of precise audio editing in my project, there are some audio cuts that are not aligned on frames. It's not a big problem, I just wanted to let you know. The solution is very simple: render only the video track, then render the audio track in WAV and then mux them together with ffmpeg, copying the video track and encoding the audio one. This way the video is perfectly in sync with the audio. The strange thing is that, when I watch my project from the compositor window, audio and video are in sync. Thank you for making Cinelerra GG a really great free software. -- Matteo Bini
Den 31.01.2024 11:27, skrev Matteo Bini via Cin:
Hello Cinelerra GG developers, I've found a strange behaviour in this great editing software.
When I render my project, sometimes the audio is out of sync. Not all the audio, but from a certain point, from half of the video the audio is out of sync and it gets worst the more we get to the end of the video. It's like latency piles up. I've only done MP4 renderings so far.
My idea, but I don't know how to demonstrate it, is that ffmpeg doesn't know how to render audio and video in sync, when there's some audio that is not aligned on frames. Since I do a lot of precise audio editing in my project, there are some audio cuts that are not aligned on frames.
It's not a big problem, I just wanted to let you know. The solution is very simple: render only the video track, then render the audio track in WAV and then mux them together with ffmpeg, copying the video track and encoding the audio one. This way the video is perfectly in sync with the audio.
The strange thing is that, when I watch my project from the compositor window, audio and video are in sync.
Thank you for making Cinelerra GG a really great free software.
-- Matteo Bini
Hi Matteo, Sorry 'I can't help other than tip about a similar thread on the old CinCVS mail archive: https://www.mail-archive.com/[email protected]/msg04730.html https://www.mail-archive.com/search?l=cinelerra%40skolelinux.no&q=audio+sync...
ср, 31 янв. 2024 г., 13:30 Matteo Bini via Cin <[email protected]>:
Hello Cinelerra GG developers, I've found a strange behaviour in this great editing software.
When I render my project, sometimes the audio is out of sync. Not all the audio, but from a certain point, from half of the video the audio is out of sync and it gets worst the more we get to the end of the video. It's like latency piles up. I've only done MP4 renderings so far.
I think there should be some muxer setting behind 'format' button if you summon ffmpeg rendering options ... but there is a lot of variables, so experimenting might become major time sink!
My idea, but I don't know how to demonstrate it, is that ffmpeg doesn't know how to render audio and video in sync, when there's some audio that is not aligned on frames. Since I do a lot of precise audio editing in my project, there are some audio cuts that are not aligned on frames.
It's not a big problem, I just wanted to let you know. The solution is very simple: render only the video track, then render the audio track in WAV and then mux them together with ffmpeg, copying the video track and encoding the audio one. This way the video is perfectly in sync with the audio.
in theory with ffmpeg 6.1 you also can render pcm in mp4 container, just not sure how many other softwares can read it yet? Also, in not so recent past we tried gpac (MP4Box) for making such mp4s. I wonder if ffmpeg's audio stream copy also fix alignment? Or only re-encoding audio?
The strange thing is that, when I watch my project from the compositor window, audio and video are in sync.
sounds like problem with timestamps (decode/presentation) , some ffmpeg (command line) users struggled with it while trying to cut/merge videos ... Any warnings if you launch cin form terminal?
Thank you for making Cinelerra GG a really great free software.
-- Matteo Bini -- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin
Not sure if this will help or not, but the default Settings is "Align cursor to frames" as seen in the Settings pulldown. But you might try to "Align cursor on frames when editing a video track and Align to samples when editing audio". Check the box on for video and off for audio in the Settings pulldown. On Wed, Jan 31, 2024 at 3:30 AM Matteo Bini via Cin < [email protected]> wrote:
Hello Cinelerra GG developers, I've found a strange behaviour in this great editing software.
When I render my project, sometimes the audio is out of sync. Not all the audio, but from a certain point, from half of the video the audio is out of sync and it gets worst the more we get to the end of the video. It's like latency piles up. I've only done MP4 renderings so far.
My idea, but I don't know how to demonstrate it, is that ffmpeg doesn't know how to render audio and video in sync, when there's some audio that is not aligned on frames. Since I do a lot of precise audio editing in my project, there are some audio cuts that are not aligned on frames.
It's not a big problem, I just wanted to let you know. The solution is very simple: render only the video track, then render the audio track in WAV and then mux them together with ffmpeg, copying the video track and encoding the audio one. This way the video is perfectly in sync with the audio.
The strange thing is that, when I watch my project from the compositor window, audio and video are in sync.
Thank you for making Cinelerra GG a really great free software.
-- Matteo Bini -- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin
чт, 1 февр. 2024 г., 01:00 Phyllis Smith via Cin <[email protected]
:
Not sure if this will help or not, but the default Settings is "Align cursor to frames" as seen in the Settings pulldown. But you might try to "Align cursor on frames when editing a video track and Align to samples when editing audio". Check the box on for video and off for audio in the Settings pulldown.
well, I think when you have BOTH video and audio on timeline and you want to move audio just a bit you must switch this mode ... but I not tried rendering yet, so I do not know if switching it back to default before rendering will improve things or not ....
On Wed, Jan 31, 2024 at 3:30 AM Matteo Bini via Cin < [email protected]> wrote:
Hello Cinelerra GG developers, I've found a strange behaviour in this great editing software.
When I render my project, sometimes the audio is out of sync. Not all the audio, but from a certain point, from half of the video the audio is out of sync and it gets worst the more we get to the end of the video. It's like latency piles up. I've only done MP4 renderings so far.
My idea, but I don't know how to demonstrate it, is that ffmpeg doesn't know how to render audio and video in sync, when there's some audio that is not aligned on frames. Since I do a lot of precise audio editing in my project, there are some audio cuts that are not aligned on frames.
It's not a big problem, I just wanted to let you know. The solution is very simple: render only the video track, then render the audio track in WAV and then mux them together with ffmpeg, copying the video track and encoding the audio one. This way the video is perfectly in sync with the audio.
The strange thing is that, when I watch my project from the compositor window, audio and video are in sync.
Thank you for making Cinelerra GG a really great free software.
-- Matteo Bini -- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin
-- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin
Could you try this render type, please? Change the compression "vp9_1280x720_24or25or30fps.webm" to your format size (1920x1080?) /* ************************** */ Render_WEBM: - Filename: yourfile_render.webm - File Format: FFMPEG - webm - Audio: - Preset: webm.webm - Bitrate: 128000 (128k) - Quality: -1 - Samples: fltp - Video: - Compression: vp9_1280x720_24or25or30fps.webm - Bitrate: 0 - Quality: -1 - Pixels: yuv420p - Video Options ( * means changed by me): # 20171119-2100 # based on https://developers.google.com/media/vp9/settings/vod/ # for explanations reference the Cinelerra Manual # 1280x720 (24, 25 or 30 frames per second) b=1024k minrate=512k maxrate=1485k tile-columns=2 g=120 (*) threads=8 quality=good crf=32 speed=4 color_primaries=bt709 (*) color_range=jpeg (*) color_trc=bt709 (*) colorspace=bt709 (*) /* ************************** */
participants (5)
-
Andrew Randrianasulu -
Igor BEGHETTO -
Matteo Bini -
Phyllis Smith -
Terje J. Hanssen