Audio reactive - H.264 Export - smoothness vs out of Sync

Hello,

I do some Audioreactive Stuff with TD . When finished I export the “work” with H.264 Codec via MovieFileOutTop (not in Realtime). I encounter that in the exportet video the “movemen” of the audio reactive Parts of my network , get more out of sync depending on the amount of smoothing via FILTER or LAG Component.
.
During creating the “Nodes-Network” I usally check the Result via “Top-Viewer” to see how to tweak the “Nodes-Network”. This is all the time running in “REALTIME-MODE”, in this “REAL-TIME” Mode … I see a little “out of sync with the sound” but it is ok and not so much like in the exported Video.

Someone has a clue what could be the reason having this differences ? Between the TD Realtime View and the exported Video ?

I usually smooth the Incomming sound like this

with 0.1 Filter Width → the "out of sync in the Video gets better, but in Realtime VIew inside TD the “audio reaction” is more agressiv

with 0.3 Filter Width → the "out of sync in the Video gets worser, but in Realtime View inside Td the “audio reaction” is smoother

maybe my way of Smoothing the Sound is wrong ?

I found the following on this board:

=> but in AudioFileIn i can not see something to link to “the current Framerate”

thanks for paying attention
Peter

tst_sync_audio_visuals.toe (34.0 KB)
here is a sample file to check it out.
if I play it in TD everything is fine the Circles react in sync with the Audio. But Exporting it to a file … they are not in sync.
(anyway if Exporting in Realtime or not)

Hi @PBruch,

could you share a rendered out movie of your example network where this effect can be observed? Don’t think I’m able to reproduce.

cheers
Markus

HI @snaut
hope you can see the slight delay between the vid and when you play direct in Touchdesigner
here after uploading on YT: https://youtu.be/f-YY3BedHEI
here is the file : File for downloading

Exporting done with “REALTIME unmarked”. + did not see the framerate dropping
Done with: TD Version: 2023.11340
Graka: NVIDIA RTX 3060 Driver: Studioversion 546.33 (DCH)

=> NVIDIA + TD Version not the newest, but encountered the “not so in sync” also in older versions of TD and NVIDIA Drivers

for me:

  • wenn playing direct in TD: the big circles pump in sync with the “bass”
  • playing file with VLC : the reactivion of the circles is a bit late
  • playing on Youtu : like playing with VLC

Hello,
I did some Software-updates: Now
NIVIDA Studio Driver is. 560.81
Touchdesigner is: 2023.11880

but , “the out of Sync” is still present in the exported vid.
Youtube sample
I exported to .mov and .mp4 … in both files still “the out of sync” exists

someone has any Idea ?

Hi @PBruch,

great - thank you! I made a little test network which might indicate that a possible delay might be introduced by the playback software?

I recorded the video and added a beep at the end plus also just to be safe added a frame counter.
Next I brought back the recorded movie file and used it’s audio via the Audio Movie CHOP to drive the animation and compare it with the recorded video. What I see is a slight frame delay of maybe 1 frame between the 2.

Attached here my test setup and a link to the recorded video.
I hope there are no logical misconceptions in my analysis here…
cheers
Markus

tst_sync_audio_visuals.3.toe (39.0 KB)
sync_audio_visual4.mov

Hi @snaut

thanks for your effort. !

great - thank you! I made a little test network which might indicate that a possible delay might be introduced by the playback software?

I use VLC and the WIindows “own” Mediaplayer … they both show the “Unsync”.
If I play your “sync_aduio_visual4.mov” via Edge /Chrome or Firefox – also the “Unsync” is visible.

Let`s step a little bit back you wrote in your first answer:

could you share a rendered out movie of your example network where this effect can be observed? Don’t think I’m able to reproduce.

Just to get the point here.

  • You played the network … looks for you “in Sync” ?
  • exported the movie, played it “in a player” outside TD … looks for you “in Sync” ?

Hello again,

I`ll try to figure the “unsync” out … maybe it depends on the way I create the vid ?

how do I create the vid:

image

  • after “the End” is reached or sometimes 20 Minutes later (becaus the creating of the vid is mostly 1 Hour music mixes, so I do other stuff in the meantime) , I Press Record “off” in “THE MOVIE Fileout comp”.
    image

  • I dont want to use the Export-Movie Dialog, because it is not handy for me

Hi @PBruch,

I can observe in external players that the video and audio seem to be slightly offset but my test file shows that the movie and it’s audio are in sync as I’m driving the animation with the audio from the movie and look at the difference between the movie and the animation.

Now when loading it into a editing software I seem to be able to see the difference again - I’m having a closer look at this.

The way you record is absolutely legit - same as I record. I’ll get some feedback on your codec settings…

cheers
Markus

Addendum: From my testing Premiere loads and plays with an audio offset and when re-exported from premiere will also have this offset in the file. DaVinci on the other hand everything looks properly in sync.

Hi @snaut

sorry for late reply … actually I do not how much spare time. Anyway.
my Codec settings are for the reason, uploading VIDs to Youtube. Here some can find them:

this is what youtube suggests

therefore i choosed the following settings:

image

I can observe in external players that the video and audio seem to be slightly offset
For me this looks like: "the way the vid is generated has “a problem”, but there is not much I can dig deeper in.
Hopefully someone from “TD” could take a closer look at it. Maybe I should open “a Ticket ?”

thanks for your support
Peter

Hello @Snaut

maybee …the Solution / Problem is located in these three Parameter settings

(1) AudioOut
(this is what I hear during Development. If I set this to Let`s say 90, than I can see a outof sync between Audio and Visual if looking on the TD generated visual (not the vid)
I assume with Buffer lenght in this Operator, I set the starting point, after Buffer is filled with Audiodata, when the Music starts to play

(2) Audiofilein1
The amount of audio to buffer to maintain smooth playback.
I assume (1) AudioOut and this Operator should have the sam “Number”, because than the Audio starts playing at the same time

(3) Filter1

TEST1

I tried the following:
AudioOut->BufferLenght = 12 Frames
Audiofilein1->Pre-Read Length = 12 Frames
AudioFilein1->Filter Width = 12 Frames

DirectPlay in TD : Audio + Visual are in Sync and “smooth”
Exporting to .mov: they are still a little out of Sync

*hmmm … it seems I`m on the wrong way to find a solution

TEST2

AudioOut->BufferLenght = 12 Frames
Audiofilein1->Pre-Read Length = 12 Frames
Bypass the Operator AudioFilein1->Filter Width = 12 Frames

DirectPlay in TD : Audio + Visual are in Sync but to harsh
Exporting to .mov: harsh, but a little of of Sync

*hmmm … so actually I assume the Filter Operator has nothing todo with this Sync difference

TEST3

AudioOut->BufferLenght = 60 Frames
Audiofilein1->Pre-Read Length = 60 Frames
Bypass the Operator AudioFilein1->Filter Width = 12 Frames

DirectPlay in TD : Audio + Visual are Out of Sync and harsh
Exporting to .mov: harsh, but it looks the sync is better but not

*hmmm … If I press play in TD to run the whole Network I can see that the visual Starts moving before the Music starts to play … this could indicate that
AudioOut->BufferLenght and Audiofilein1->Pre-Read Length correlate and influence the SYNC
well if this is true … does someone knows this ?? (just to avoid try and error on every upcoming vid)

Hey, so one misconception here is that the Pre-Read Buffer size for Audio File In CHOP does not apply any delay to the audio. This controls how much extra data is prepared to play, but the audio being output is the value being requested without any delay.
The filter does apply a delay to the motion, since it’s smoothing the motion.

One thing to keep in mind is that the settings to make the audio insync for Audio Device Out CHOP, will be different than what you need for Movie File Out. This is because the Audio Device Out CHOP requires a buffer, it will play the audio the buffer-length in time later.
Movie File Out TOP requires the audio to be output in perfect sync with the video, since the players will be handling the audio-sync, depending on the buffer size they use.

This is why the Audio Movie CHOP by default has an an Audio Sync Delay, because we are assuming you want to sync with an Audio Device Out CHOP with the same buffer size.
If you want to record direct to Movie File Out, you would make this offset 0.

So if you are using Audio Movie with a Filter of 0.2 to control the motion, and recording a Movie, then you’d apply an Audio Sync Offset of -0.2 to the Audio Movie.
If you are trying to listen to it using Audio Device Out, then you’d apply an offset of -0.05, assuming your Audio Device Out CHOP is set to 0.15.