Log in

View Full Version : Comparing two audio streams


nudelbubu
22nd May 2012, 15:55
hi. i recently bought the bluray of a movie i already own on dvd. unfortunately one the the languages i wanted is not available on bluray. so i want to import it from the dvd. the dvd and bluray seem to be slightly different though (equal at the beginning and ~5 frames apart near the end).
my approach would be to compare the english 5.1 stream (which is available on both) to find the places, where i need to edit the language, i want to import.

are there any tools for that (preferably freeware or open source)? finding the timecode, where a difference occurs would be enough. any suggestion on a different approach is also welcome.

thx in advance

LoRd_MuldeR
22nd May 2012, 22:53
If you invert one of the streams and then mix together the two streams, they should cancel out each other - resulting in an (almost) silent stream.

At the point where the streams "desync" you will see that the difference signal changes from silent to non-silent.

I think every basic audio editor can do this. I usually use the "mix paste" feature of Cool Edit, which also has a very useful "invert" check box for this task.

SoX could do it too, if want something that can be scripted...

nudelbubu
24th May 2012, 19:57
thanks. i guess i'll try mixing with sox and then looking through the file in audacity (as mixing in audacity seems rather tedious). i was hoping for a method a little more automated though ;)

pandy
25th May 2012, 10:48
In theory You can do correlation in any math package like Matlab, Octave or SciLab, correlation can be made in frequency domain (this should be less sensitive to level difference and level changes, also noise) - however in real life it will be probably very slow however You can try to speed whole process by accelerating some parts by GPGPU.

nudelbubu
27th May 2012, 15:47
@pandy sounds interesting, but i guess the time i would need to get used to those programs is probably not worth it.

i also ran into some problems. i looked through the files and noticed i would have to adjust them by less than 1ms, which isn't that easy in most programs. even then, the bluray track was still too different from the dvd one to find the differences by mixing. it was close enough to be human recognizable though. so here's how i succeded, in case anyone wants to know:

first i reencoded both videos to 720x576 with x264, preset ultrafast, loaded them with ffmpeg (so it is indexed) in an avs script with virtualdub and stacked them [StackHorizontal(blank+sd,hd) where blank is a blank clip to readjust the two clips, when they drift apart]. i could now find the approximate positions for changes by scrolling through the file (i checked for differences all ~200 frames and alt+right seeks 50 frames in vdub, so it wasn't as bad as it may sound ;))

i then converted both english streams to mono (as the dvd was 25fps and the bluray was 23.976, i had to add a pal-to-ntsc slowdown to the dvd stream) and loaded them in audacity. i searched for the positions found with vdub and adjusted them, writing down the exact offset for them to fit.

then i only had to apply this to the (also slowed down) other language stream. thanks again to LoRd_MuldeR and pandy, you at least set me on the right track :thanks:

pandy
30th May 2012, 10:58
@pandy sounds interesting, but i guess the time i would need to get used to those programs is probably not worth it.

I agree - doing this from scratch have no sense, but - perhaps, there is somewhere package used for academic (science) purposes - like speak recognition, forensic etc.