Not sure if this is the right place to ask, but I try anyway.I have a bunch of SFM renders which loop perfectly fine, but only without audio. When audio is added, a small delay occurs when the video restarts.I use ffmpeg to convert them to mp4 (libx265/aac), and it looks like no matter what I try, the audio is always 20-100ms longer (even with -shortest flag).Is there any way to force ffmpeg to make the audio and video stream to have the exactly same size, down to the ms?The files need to be re-encoded so I want the results to be as good as possible. mp4 is not set in stone if another container is better.
I'm no sfm expert but why don't you overlay the audio in another package? Bit of a shit work around but it would also actually work
>>553429The problem does not come directly from SFM, but from the conversion it seems.From what I understand, it's somewhat related to framesizes.With eg 30fps, each frame has a duration of 33.3ms. For aac it seems a frame is ~26ms.The Opus specs say that frames of that codec can be as short as 2.5ms (frame_duration), but I cannot get ffmpeg to create output with a difference of ~2.5ms between video and audio.
If you cut the audio track short of the end of the video track does it still encode blank audio to the end of the animation and cause this problem? Can you just use a different codec or encoding software?
>>553533If I remove the audio, it loops fine.I have to batch convert >200 files, so manually editing the audio isn't really an option.Also, I tried h263, h264, libx265 with similar results.It looks like there is no way to make it loop smoothly
>>553542Are you using MP3 audio? Try Vorbis or AAC, it might be an issue with MP3's initial delay.
>>553372>I use ffmpeg to convert them to mp4 (libx265/aac)>>553528tried opus
>>553528I know that after effects can interpret footage at a variable rate so you could try and match them together but unfortunately I cannot offer any more wisdom
in the past, there were a few occasions in which i had to add audio after the video was created. to make sure the audio lasted for exactly as long as the video, i did the following:use ffprobe on the video to find the video's duration (right down the the centisecond)create a blank track in audacity with same duration as videogenerate my audiouse the command: ffmpeg -i my-video-file -i my-audio-file -vcodec copy -map 0:0 -map 1:0 my-output-filethe only hiccup was that the resulting video changed from 24 fps to 20.98 fpshowever the video retained it's original duration with no video/audio speedup/slowdown at any point. i think that may have something to do with the audio's sample rate, but i'm not too sure.
download audacity and change the format to 16 bit bro ;)