Log in

View Full Version : converting ac3 from PAL to NTSC


hanen87
18th November 2007, 05:12
hi,

i believe this question has been asked before... it's just i dont hv the time to read every single thread in here n do a search cos i'm busy with my work n some uni assignments.

i got a 25fps foreign audio track which i wanna mux it into a 23.976fps movie. i applied 25000/23976 at "stretch by" option in mkvtoolnix. however, i've notice frame skipping at the result. does anyone hv a solution for this problem?

varunb
18th November 2007, 07:35
The preferred method is always to re-encode the audio. Use besweet or behappy for 25fps ac3 -> 23.976fps ac3 conversion. This will also ensure that no audio-video synchronisation problem occurs.

hanen87
18th November 2007, 10:13
is that the only way? cos re-encoding will reduce the quality right?

burfadel
18th November 2007, 10:20
Could convert the ac3 to a wave file, set the playback rate to 46033 (which is correct for the conversion) then resample it back up to 48khz... which will keep the length of the audio correct for the 23.976 video. Then recode to aac/mp3/ac3 etc

You'll have to recode the audio, but the conversion method is almost lossless. Time stretch functions can stuff the audio up and lower its quality, it all depends on the method of stretching. Most stretching involves processing and recompressing.

The only method of stretching the AC3 is to convert the playback rate to 46033, but I'm not sure if that can be done or not. Thats the sample playback rate, so it says to playback 46033 samples a second instead of 48000. Most encoders/decoders require standard rates, and AC3 may only be at 48000.

varunb
18th November 2007, 12:19
Hanen87, the loss in quality will only be minute. I agree with burfadel that u should decompress it to WAV & then perform 25fps->23.976fps conversion but i don't think that u should change the sample rate at all, as he has said. Its totally unnecessary. Moreover, changing the sample rate will result in quality loss.

hanen87
18th November 2007, 12:55
can u explain the steps of converting ac3 to wav n re-convert it back? which software is the best choice?

madshi
18th November 2007, 13:02
You could try muxing the file into MKV. There you can enter a timestretch value, I believe. But I'm not sure if it actually works. Never tried it yet. And *if* it works it will probably only work if you decode audio instead of sending it as AC3 over SPDIF. So I'm not sure how useful it is.

Probably your best bet is to reencode. That's not nice, but there's no other way. You could also use the latest version of the eac3to tool, btw. With it you can do this (at command prompt):

"eac3to source.ac3 dest.ac3 -slowdown"

This will do exactly what you need.

hanen87
18th November 2007, 13:35
i've tried that before... n the movie suffer from frame skipping every few seconds after using time stretch in mkvtoolnix

You could try muxing the file into MKV. There you can enter a timestretch value, I believe. But I'm not sure if it actually works. Never tried it yet. And *if* it works it will probably only work if you decode audio instead of sending it as AC3 over SPDIF. So I'm not sure how useful it is.

does eac3to has an option to decompress ac3 to wav format as what varunb said?

Probably your best bet is to reencode. That's not nice, but there's no other way. You could also use the latest version of the eac3to tool, btw. With it you can do this (at command prompt):

"eac3to source.ac3 dest.ac3 -slowdown"

This will do exactly what you need.

varunb
18th November 2007, 14:01
U haven't mentioned the input & output format of the audio file.....ac3, aac, mp3, flac, etc ??

burfadel
18th November 2007, 14:03
I think the way the 25-23.976 fps works is by changing the playback sample rate to 46034 (the slowdown of 48000 required to make it 23.976) then upsampling (which shouldn't result, in theory, in quality loss) back up to 48000.

The playback sample rate is stored as information in the wav file, you can set it to anything you like without changing the actual audio. At 46034, the wav file will fit your 23.976 film. If you set the playback rate to 100hz, the actual audio will still be identical to the original, the player is just instructed to pass 100 samples a second instead of 48000! hence a slowdown :)

The 48000 --> 46034 conversion works because 46034 samples a second, compared to 48000 samples a second, is equivalent to 23.976. More precisely, its 46033.92 samples a second, but the difference equates to 0.0063 seconds/hour which is um, definitively neglible!

The upsampling from 46034 just remaps the points that make the waveform (essentially), having a higher samplerate shouldn't result in a loss of quality.

Timestretch functions based on other means, such as fft, is definately NOT a good way of doing it, as this will severely affect quality. The only time a more complex way of converting it from 25fps to 23.976 is if you want to save the 25fps pitch, but you do not want to do this as the pitch that you'll end up with, will be the original intended audio pitch! :)

burfadel
18th November 2007, 14:08
U haven't mentioned the input & output format of the audio file.....ac3, aac, mp3, flac, etc ??

Thats true, it would help to some point knowing this in terms of programmes to use, but regardless of the input format the way I listed it is the most suitable method... there's probably programmes that employ this method, I should point out changing the playback rate is instaneous, not even half a second for a fill movie, as its only changing the samples/second header. The resampling of a movie length should be very quick also.

A programme that can be used for what I suggested is goldwave:
www.goldwave.com
Without registering, it gives you 100 function uses then it comes up with the register window, but you can keep using it. The function window will come up every 3? functions thereafter. This is per session, so next time you use it the count starts off again! So if you load, change the playback rate, resample, and save, thats only 4 function uses!

tebasuna51
18th November 2007, 14:30
Timestretch functions based on other means, such as fft, is definately NOT a good way of doing it, as this will severely affect quality. The only time a more complex way of converting it from 25fps to 23.976 is if you want to save the 25fps pitch, but you do not want to do this as the pitch that you'll end up with, will be the original intended audio pitch! :)
Not always. Maybe you can recover the original pitch or maybe the pitch in 25 fps is the correct.

If the 25 fps pitch is the correct you need use the more complex methods to preserve the pitch, of course you lose quality (always) but supportable, better than listen child speak like adult.

burfadel
18th November 2007, 14:37
True! although the pitch difference isn't great enough for that (just under one semitone). There's very little material that is pitch-shifted, so the 46034 method should be fine :) Besides, there's audio quality reduction using pitch shift.

hanen87
18th November 2007, 15:06
Input: AC3 5.1, 448Kbps, 48KHz (grabbed directly from PAL DVD)
Desired output: AC3 5.1, 448Kbps, 48KHz (sync to NTSC x264 video...more preferably without loss of quality after the conversion)

This is the first time i'm doing this frame rate audio conversion so i hope getting the detail steps from u guys...

U haven't mentioned the input & output format of the audio file.....ac3, aac, mp3, flac, etc ??

no offence to burfadel, but i dont think this has something to do with the audio sample rate... or mayb i'm wrong

i don't think that u should change the sample rate at all, as he has said. Its totally unnecessary.

varunb
18th November 2007, 15:53
Well I can't suggest any method to get AC3 5.1 cos I don't know which software produces better AC3 output. I can only tell u how to convert your input file to uncompressed wave alongwith timestretching it from 25fps->23.976fps. Just reply if u want me to tell you this.

tebasuna51
18th November 2007, 16:29
Using AviSynth 2.57 with SoundTouch library you can try this two methods:
TimeStretch(rate=(24000.0/250.25)) #tempo and pitch changed
TimeStretch(tempo=(24000.0/250.25)) #tempo changed, pitch preserved

The first one is the method suggested here.

The complete process can be do with:
AviSynth 2.57 (frame server)
NicAudio.dll (ac3 decoder AviSynth plugin)
Aften.exe (free ac3 encoder)
.NET Framework v2.0 (only if BeHappy is used)
BeHappy (GUI for AviSynth avs scripts and Aften encoder)

Instead Aften, .NET and BeHappy you can use the SoundOut AviSynth plugin and VirtualDub to open an .avs file like:
NicAc3Source("E:\yourpath\test.ac3")
TimeStretch(tempo=(24000.0/250.25)) # or rate
SoundOut()

The first method is equivalent to:
eac3to source.ac3 dest.ac3 -slowdown
with the last eac3to v2.01, but here r8brain lib is used instead SoundTouch. I can't test this method because not free ac3 decoder is used.

madshi
18th November 2007, 16:35
i've tried that before... n the movie suffer from frame skipping every few seconds after using time stretch in mkvtoolnix
Ok, then reencoding is your only choice.

does eac3to has an option to decompress ac3 to wav format as what varunb said?
Sure. You can do that with "eac3to source.ac3 dest.wav -slowdown". However, you later said that your desired output is AC3 448kbit/s. In that case why decoding to WAV? Just do "eac3to source.ac3 dest.ac3 -448 -slowdown" and you're done.

more preferably without loss of quality after the conversion
AC3 is a lossy encoder. That means it throws away some audio data. That means everytime you encode something with AC3 you're losing a tiny bit of quality. Not much, if the encoder is good. But a little bit. And then reversing the PAL speedup also costs a tiny bit of audio quality. No way around that. But the loss should be small, if the processing is done well.

Don't ask me if you can hear the loss in audio quality. Maybe you can't. You'll have to try that for yourself. Everybody has different ears...

madshi
18th November 2007, 16:38
Not always. Maybe you can recover the original pitch or maybe the pitch in 25 fps is the correct.

If the 25 fps pitch is the correct you need use the more complex methods to preserve the pitch, of course you lose quality (always) but supportable, better than listen child speak like adult.
You are right. But "not always" in real life is "nearly always". I'd go as far as to say that at least 99% of all PAL audio tracks have too high pitch. Of all the DVDs I've ever checked there's only one single PAL title which ever did NOT have a too high pitch (and that is LOTR). Every other title I've seen had too high pitch.

hanen87
18th November 2007, 16:40
tebasuna51, i'm kind of noob in those stuff n i've no idea how to do it in script system... i need a GUI instead so i tried out BeSweet. Can someone confirm whether my setting is correct?

http://img46.imageshack.us/img46/3706/bs1la4.png

http://img20.imageshack.us/img20/9871/bs2ls4.png

madshi
18th November 2007, 16:43
I think the way the 25-23.976 fps works is by changing the playback sample rate to 46034 (the slowdown of 48000 required to make it 23.976) then upsampling (which shouldn't result, in theory, in quality loss) back up to 48000.
Yes and no. If the pitch of the PAL track is too high (which it usually is) resampling from 48000 to 50050 is the correct way of undoing the PAL speedup. It's only one step. After the resampling to 50050 is done you just flag the result as 48000 and that's it.

Timestretch functions based on other means, such as fft, is definately NOT a good way of doing it, as this will severely affect quality. The only time a more complex way of converting it from 25fps to 23.976 is if you want to save the 25fps pitch, but you do not want to do this as the pitch that you'll end up with, will be the original intended audio pitch! :)
I agree. Of course to every rule there is an exception: There are some (very few, though) PAL tracks which were pitch corrected by the studio. Those tracks are ugly to work with, obviously. They have artifacts in them by the studio's pitch correction. And then if we want to undo the PAL speedup which have to use pitch correction again, which adds further artifacts on top. Really ugly. Fortunately pitch corrected PAL audio tracks are extremely rare...

tebasuna51
18th November 2007, 17:40
You are right. But "not always" in real life is "nearly always". I'd go as far as to say that at least 99% of all PAL audio tracks have too high pitch. Of all the DVDs I've ever checked there's only one single PAL title which ever did NOT have a too high pitch (and that is LOTR). Every other title I've seen had too high pitch.

Maybe is true for english audio tracks with originals for NTSC countries, but I never listen high pitch in spanish tracks for instance (I can't speak by other european languages).

madshi
18th November 2007, 17:50
Maybe is true for english audio tracks with originals for NTSC countries, but I never listen high pitch in spanish tracks for instance (I can't speak by other european languages).
I'm mainly talking about German audio tracks. Pitch corrected German PAL tracks are *extremely* rare. That's interesting to hear that Spanish audio tracks are often pitch corrected!! I pity you because undoing PAL speedup for pitch corrected audio tracks will add artifacts on top of artifacts... :( I believe we have it much better here in Germany. Simple timestretching doesn't hurt audio quality that much.

tebasuna51
18th November 2007, 17:57
tebasuna51, i'm kind of noob in those stuff n i've no idea how to do it in script system... i need a GUI instead so i tried out BeSweet. Can someone confirm whether my setting is correct?

BeSweet is not recommended for this job and less BeSweetGUI absolutely obsolete. Use BeLight instead BeSweetGUI but you can't do the job without intermediate wav files (2 pass) and limited to 62 minutes long (2 GB with 5.1, 48000 Hz, 16 bit).

BeHappy (http://www.box.net/shared/nkihizx1dh) is a GUI but you need install first AviSynth 2.57 and support for .NET Framework v2.0 (maybe included in your Windows OS)

tebasuna51
18th November 2007, 18:08
I pity you because undoing PAL speedup for pitch corrected audio tracks will add artifacts on top of artifacts... :( I believe we have it much better here in Germany. Simple timestretching doesn't hurt audio quality that much.

I don't understand your argument. If you need correct your PAL audiotracks is worse than here, I don't need any correction to listen the spanish tracks.

madshi
18th November 2007, 18:22
I don't understand your argument. If you need correct your PAL audiotracks is worse than here, I don't need any correction to listen the spanish tracks.
Oh, I think we misunderstood each other. Of course if you watch the DVD in 50Hz everything is ok with the pitch corrected tracks. But what happens if you want to mux a Spanish audio track to a 23.976 video file? In that case you're in trouble. It's still possible to convert the Spanish audio tracks to 23.976, but you'll have to do pitch correction again. Doing pitch correction TWICE on the same track can't be good for audio quality. In Germany we only have double resampling (once by the studio and once for 25->24 slowdown) which should be much better for audio quality.

tebasuna51
18th November 2007, 20:05
Oh, I think we misunderstood each other. Of course if you watch the DVD in 50Hz everything is ok with the pitch corrected tracks. But what happens if you want to mux a Spanish audio track to a 23.976 video file? In that case you're in trouble. It's still possible to convert the Spanish audio tracks to 23.976, but you'll have to do pitch correction again. Doing pitch correction TWICE on the same track can't be good for audio quality. In Germany we only have double resampling (once by the studio and once for 25->24 slowdown) which should be much better for audio quality.
If I have a 23.976 video file and need play them in a PAL system (not in PC) I need convert the video to 25 fps, the audio don't need any change. The audio don't have framerate only duration, and of course can't match with a video speedup (is 23.976 but played at 25 fps)

madshi
18th November 2007, 21:21
If I have a 23.976 video file and need play them in a PAL system (not in PC) I need convert the video to 25 fps, the audio don't need any change. The audio don't have framerate only duration, and of course can't match with a video speedup (is 23.976 but played at 25 fps)
Of course it's also possible to speed up the video. But then you end up with incorrect video speed *and* incorrect audio speed and eventually even audio artifacts caused by pitch correction. Personally, I prefer to have the correct video and audio speed and no pitch correction... :)

tebasuna51
19th November 2007, 01:41
Of course it's also possible to speed up the video. But then you end up with incorrect video speed *and* incorrect audio speed and eventually even audio artifacts caused by pitch correction. Personally, I prefer to have the correct video and audio speed and no pitch correction... :)

I don't want polemize about this but I continue without understand your arguments.

If I have a original video for NTSC with 23.976 frames per second and I play in a PAL system at 25 fps then the video is really speedup. Then I need insert a new frame each 24 to obtain a correct video speed. A video with 23976 frames is 1000 sec. long if played at 23.976, we need 25000 frames to same duration played at 25 fps.

I know is more easy change the audio than the video but the idea is: the audio not need changes (don't have framerates, the duration is the same in PAL or NTSC) if we change the audio is to sync with video wrong played.

madshi
19th November 2007, 09:12
I don't want polemize about this but I continue without understand your arguments.

If I have a original video for NTSC with 23.976 frames per second and I play in a PAL system at 25 fps then the video is really speedup. Then I need insert a new frame each 24 to obtain a correct video speed. A video with 23976 frames is 1000 sec. long if played at 23.976, we need 25000 frames to same duration played at 25 fps.
You're talking about a "PAL system". That's not what I'm talking about. My home theater setup can play 23.976 in its native form (without frame rate conversion). I can also play 25.000, 50.000 and 59.940 natively without FRC. Now practically every movie was originally recorded in 23.976. I don't want the movie to play at 25.000. I want to see it as it was recorded and as it was shown in real cinema.

When you add an additional frame when going from 23.976 to 25.000 there's a slight motion judder visible with smooth pans. Alternatively you can just speed up the whole video to play at 25.000. You'll get smooth playback that way - but the playback is too fast (faster than reality, faster than the movie was recorded). I don't want that.

Of course, if your home cinema setup can only handle 25.000 correctly, then you have no choice. But I wonder how you watch HD DVD and Blu-Ray then (which are mastered and played back by standalone players in 23.976p or 59.94i)?

hanen87
19th November 2007, 09:28
Thanks! I'll try out BeLight instead... btw, do u mean i hv to convert to wav before changing from 25fps to 23.976fps? My desired output is AC3 5.1...

BeSweet is not recommended for this job and less BeSweetGUI absolutely obsolete. Use BeLight instead BeSweetGUI but you can't do the job without intermediate wav files (2 pass) and limited to 62 minutes long (2 GB with 5.1, 48000 Hz, 16 bit).

BeHappy (http://www.box.net/shared/nkihizx1dh) is a GUI but you need install first AviSynth 2.57 and support for .NET Framework v2.0 (maybe included in your Windows OS)

hanen87
19th November 2007, 10:24
Now i got a problem again :( Every time i hit "Start" in BeLight, the BeSweet command line window just pop up for 1 sec n nothing happen... What should i do?

btw, what's the purpose of Azid Settings? can i uncheck it?

tebasuna51
19th November 2007, 11:50
But I wonder how you watch HD DVD and Blu-Ray then (which are mastered and played back by standalone players in 23.976p or 59.94i)?

I can't. For this reason I need convert the movies. If a system can play all the formats, what is the reason to convert the data?. Play the original ones.

madshi
19th November 2007, 12:23
If a system can play all the formats, what is the reason to convert the data?
There are 2 reasons why I'm converting data, even though my system can play all formats:

(1) Sometimes I import a HD DVD or Blu-Ray disc (23.976) from USA and then I'm adding a German audio track (25.000) to it. Obviously this doesn't match without converting either audio or video.

(2) I prefer watching movies in 23.976 because that's the way the movie was originally recorded and shown in cinema. For my taste it's "wrong" to watch movies in 25.000. So I like to convert my recorded HDTV broadcasts from 50i to 47,952i.

tebasuna51
19th November 2007, 13:07
btw, what's the purpose of Azid Settings? can i uncheck it?

Azid is the ac3 decoder, for transcoding purpose you must uncheck all the azid settings included Dynamic Compression.

Now i got a problem again :( Every time i hit "Start" in BeLight, the BeSweet command line window just pop up for 1 sec n nothing happen... What should i do?

You are right, BeLight-BeSweet can't stretch multichannel wav's only work fine with stereo wavs (soundtouch lib), we can use multichannel with ota option (not accesible with BeLight, only replacing 'soundtouch' by 'ota' in command line) but is not a good conversion because change the pitch.

To do this 'ota' conversion need a command line like (with your "path's"):
"H:\path1\BeSweet.exe" -core( -input "i:\path2\input.ac3" -output "i:\path2\output.ac3" -logfile "i:\path2\output.log" ) -ota( -r 25000 23976 ) -bsn( -exe aften.exe -b 448 -6chnew )

This do a conversion like eac3to but with the free decoder Azid instead the DS Nero decoder if you don't want pay for it.

- To do a conversion preserving the pitch try a AviSynth method.

hanen87
19th November 2007, 14:28
Aften.exe didnt come with the pack i downloaded... any idea where can i get it? or i could just use AC3enc.dll ?

u guys have been talking about wrong pitch in PAL track... how do i identify it's wrong? i dont hv a high end sound card...

tebasuna51
19th November 2007, 18:41
Aften.exe didnt come with the pack i downloaded... any idea where can i get it? or i could just use AC3enc.dll ?
Never ac3enc.dll use Aften:
http://win32builds.sourceforge.net/aften/index.html

u guys have been talking about wrong pitch in PAL track... how do i identify it's wrong? i dont hv a high end sound card...

Don't need a high end sound card. Record the voice of your sister (wife, mother, ...) in a sister.wav file. Then use:

eac3to sister.wav sister_slow.wav -slowdown
eac3to sister.wav sister_speed.wav -speedup

Now listen the three wav files.

Of course you need know the original pitch of an actor but if PAL tracks have wrong pitch the voices are deformed like in sister_speed.