Log in

View Full Version : AudioGraph halts after 40 seconds


Booji Boy
10th January 2010, 23:01
video = ImageSource("test.png")
audio = WAVSource("test.wav")

AudioGraph(AudioDub(video, audio), 3)


Test.png is a 1280x720 image and the WAV file is 16bit, 44.1kHz, stereo and 2:40 min:sec long. After 40 seconds the audio keeps playing but the waveform graph visualisation just freezes. When I run two AudioGraphs for left and right, they stop after 10 seconds.

When increasing the FPS it halts even faster. It seems that it can only render 1000 frames. If multiple AudioGraph functions are running even less.

Seems like a buffer overrun or an intentional limitation.

UPDATE: Hm, I just tried Histogram() as an alternative... and here the same problem occurs. The video just freezes after 1000 frames, but the audio keeps playing.

video = ImageSource("test.png", fps=60)
audio = WAVSource("test.wav")

# return AudioGraph(AudioDub(video, audio), 20)
Histogram(AudioDub(video, audio), mode="Stereo")
ConvertToRGB24 ()


Seems I'm doing something fundamentally wrong here.
:confused:

MatLz
10th January 2010, 23:23
Hi! I don't know audiograph but I know imagesource défault duration is 1000 frames....so you could try to change it.

Booji Boy
10th January 2010, 23:26
Yep, that's it. Too bad I don't know how many frames I will need for the audio tracks. I'm planning on doing a few more videos, and I don't want to calculate the needed frames for all of them.

PS: Oh well, I can just set the number very high and then use Media Player Classic to see at which frame the audio stops.

MatLz
10th January 2010, 23:49
Well...it's not difficult to calculate! Make an effort!

A little tip:
Imagesource("pic.png", fps=1, end=x)
x is the duration of your audio in seconds

Booji Boy
11th January 2010, 00:00
But won't that make the update rate of the AudioGraph output lowered to once per second, too?

So here's a little fix. ;)
Imagesource("pic.png", fps=60, end=x)
where x is the audio in seconds times the fps.

Thanks for the tip. Although it's so obvious since it's "frames per second", I didn't think of it.

Midzuki
11th January 2010, 00:03
and I don't want to calculate the needed frames for all of them.

Come on! :rolleyes: :p :D

BTW, I have used both Audiograph and Histogram(AudioLevels) for generating audio visualizations, but it requires a lot of detailed planning if the goal is a decent and "cool" result. :) It would be nice if someone wanted to write an AVS plugin that calls some of the capabilities of the BASS .dll(s). :cool:

http://forum.videohelp.com/images/guides/p1979295/bass-examples.png

Booji Boy
11th January 2010, 00:15
Come on! :rolleyes: :p :D
Hey, (FPS * length of song in seconds) is hard enough!

BTW, I have used both Audiograph and Histogram(AudioLevels) for generating audio visualizations, but it requires a lot of detailed planning if the goal is a decent and "cool" result.
I'll post a link to the result of my efforts when conversion and uploading and YouTube's conversion is done... of course, nothing more than just something to make listening to the song not so dull.

Here it is:
http://www.youtube.com/watch?v=z8yXbIT8FC0&fmt=22

Too bad the 60 FPS didn't survive YouTube's conversion. Max FPS at YouTube seems to be 30 at the moment, even for HD content.

Code used (changed to 30fps)
image = ImageSource("2_years_crest_cropped.png", fps=30, end=4830, pixel_type="RGB32")
blank1 = BlankClip(length=4830, width=1280, height=310, fps=30, color=$000000)
blank2 = BlankClip(length=4830, width=1280, height=310, fps=30, color=$000000)

stereo = WAVSource("2_years_crest.wav")
left=GetLeftChannel(stereo)
right=GetRightChannel(stereo)

middle = AudioGraph(AudioDub(image, stereo), 72)
upper = AudioGraph(AudioDub(blank1, left), 3)
lower = AudioGraph(AudioDub(blank2, right), 3)

return ConvertToYV12(AudioDub(StackVertical(upper, middle, lower), stereo))

Unfortunately the YV12 conversion makes the bright green lines look greyish.

Midzuki
11th January 2010, 04:06
Just some comments:

"fps=30" is «too much» IMHO --- I would start at fps=15 or fps=10,
and later I'd simply duplicate/triplicate every frame.

Besides,

middle = AudioGraph(AudioDub(image, stereo), 72)
upper = AudioGraph(AudioDub(blank1, left), 3)
lower = AudioGraph(AudioDub(blank2, right), 3)

Audiograph(clip, 0) or Audiograph(clip, 1) is
more-than-sufficient for my preferences. :)

P.S.: The background music is kool. :) :) :)
Not "excellent" or "superb", but definitely it's *not* garbage.
<!-- *THUMBS UP* -->

Gavino
11th January 2010, 11:50
Hey, (FPS * length of song in seconds) is hard enough!
Note that 'length of song in seconds' can be calculated in the script as AudioLengthF(audio)/AudioRate(audio). That way you don't need to plug in the values by hand for each audio file.

Booji Boy
12th January 2010, 18:38
"fps=30" is «too much» IMHO --- I would start at fps=15 or fps=10,
and later I'd simply duplicate/triplicate every frame.
Hm, but I want the audio graph to be really smooth. As smooth as YouTube allows it to be.


Audiograph(clip, 0) or Audiograph(clip, 1) is
more-than-sufficient for my preferences. :)
I don't know if you're referring to the variable names now, or just left and right channel visualisation in the video...

The variable names are used so I don't get confused and the stereo graph is there because I want the viewer to have a wider view of the song's graph, therefore I show 145 frames. The left and right channel graphs are set to only visualise only 7 frames in order to show people that chiptune sounds not only sound cool but are also cool to look at.

P.S.: The background music is kool. :) :) :)
Not "excellent" or "superb", but definitely it's *not* garbage.
<!-- *THUMBS UP* -->
Thanks, it's not mine. It's from 1994 by someone who made chiptunes for the Amiga demo and cracker scene. I'm planning on making several chiptune videos in this (or maybe a refined) style.

Note that 'length of song in seconds' can be calculated in the script as AudioLengthF(audio)/AudioRate(audio). That way you don't need to plug in the values by hand for each audio file.
Oh thanks, that's very helpful for making the script more generic.