Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Linux, Mac OS X, & Co

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th June 2010, 10:02   #1  |  Link
bernd_b
Registered User
 
Join Date: Jan 2003
Location: Germany
Posts: 65
ac3 reencoding other options than BeSweet

Because I like to convert my PAL-TV-Recordings to the original movie lenght, I do a conversion to ntsc or recently to 24p too.

Because of the resulting different movie length, I have to at least reencode the ac3-audio streams.

For audio-only reencoding, the only tool I found to do the Job is BeSweet. Of course, I need wine to to the job in linux.

Googling furhter around, I am a little confused by threads like this: http://forum.doom9.org/showthread.php?t=127663.

So questions:
1. Are there maybe better and newer, maybe native linux applications to do the job of changing the lenght of an audio-ac3-file?
2. Do I suffer from this ac3enc-bug (didn't notice so far and found the resulting sound accurate and soft).
3. Can I use aften only with the BeLight-Gui or with the commandline BeSweet as well? So far I can see aften itself cannot change the lenght of an audio-file?

Last edited by bernd_b; 9th June 2010 at 10:47.
bernd_b is offline   Reply With Quote
Old 9th June 2010, 22:38   #2  |  Link
Nick
One click is all it takes
 
Nick's Avatar
 
Join Date: Mar 2002
Location: Heart of the Broad Acres
Posts: 1,404
Some answers
1. Changing timelength inevitably requires re-encoding. I don't know of a native linux encoder that comes close to Aften for quality but as you know it alone won't do the timeshift. I would imagine ffmpeg would allow you to demux to wav whilst altering the framerate. You could then feed the wav file into Aften.
2. The ac3enc.dll shipped with the last release of BeSweet is nowhere close to Aften in terms of quality but it's all about what you're happy with.
3. You could try putting Kurtnoise's updated bsn.dll file in your BeSweet directory, along with a Windows compile of Aften.
http://kurtnoise.free.fr/BeLight/bsn_20070513.zip
http://aften.softpedia.com/
then navigate to your besweet directory and use a commandline along the lines of
wine ./besweet.exe -core\( -input Extracted_audio_1.ac3 -output Encoded_audio_1.ac3 -logfile C:\temp\Encoded_audio_1.log \) -azid\( -g max \) -ota\( -r 25000 24000 \) -bsn\( -exe aften.exe -b 384 -6chnew -readtoeof 1 \)
(note -6chnew only necessary for 5.1 streams - omit this for stereo)

Alternatively, search for "eac3to wine" - see if you come up with anything useful.

Last edited by Nick; 10th June 2010 at 00:04.
Nick is offline   Reply With Quote
Old 10th June 2010, 11:58   #3  |  Link
bernd_b
Registered User
 
Join Date: Jan 2003
Location: Germany
Posts: 65
Tank you very much for your answers.

As far as I understood ffmpeg is of no help because it is build to change the frame rate without altering the length (deinterlace, pull-up/down or simply dropping frames). I just want to revert the speed up - so changing length is intended. But It took me months to get mencoder to work for me - so maybe useful options of ffmpeg are still hiding from me ...

Taking your infos into account, I'll think about trying two things:

1. Using windows-aften with beSweet as decribed in your post (although I still wonder why my ears won't find a problem with ac3enc.dll, maybe because I use a high bitrate like 448 anyway?)

2. I found out that sox has a promising option called "stretch" which claims to alter the lenght of an audio file without changing the pitch - this - together with aften - maybe will do the job I'm running nowadays with beSweet even native on linux?
bernd_b is offline   Reply With Quote
Old 10th June 2010, 13:09   #4  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by bernd_b View Post
As far as I understood ffmpeg is of no help because it is build to change the frame rate without altering the length (deinterlace, pull-up/down or simply dropping frames).
Ffmpeg can change the framerate and alter length when the user forces an input framerate, but that only works with input formats which don't have timestamps. That's probably not what you have, so you'd need to use the setpts filter.

MEncoder or some actual muxer tool is probably an easier option. For example, if you're muxing to Matroska, mkvmerge can change the framerate for you.

Quote:
2. I found out that sox has a promising option called "stretch" which claims to alter the lenght of an audio file without changing the pitch
You should first determine how the audio was treated in the Film->PAL conversion. I'd guess that usually audio is stretched simply by speeding up and resampling, so that pitch is altered too. In that case you'll want to do the same in reverse by simply slowing down and resampling back to 48 kHz. Along the encoder, resampling filter is a critical component, so pick it wisely.
nm is offline   Reply With Quote
Old 10th June 2010, 13:57   #5  |  Link
Nick
One click is all it takes
 
Nick's Avatar
 
Join Date: Mar 2002
Location: Heart of the Broad Acres
Posts: 1,404
Quote:
Originally Posted by bernd_b View Post

Taking your infos into account, I'll think about trying two things:

1. Using windows-aften with beSweet as decribed in your post (although I still wonder why my ears won't find a problem with ac3enc.dll, maybe because I use a high bitrate like 448 anyway?)

2. I found out that sox has a promising option called "stretch" which claims to alter the lenght of an audio file without changing the pitch - this - together with aften - maybe will do the job I'm running nowadays with beSweet even native on linux?
The broader the dynamic range of the source, the lousier the encode, is a good rule for BeSweet's native AC3 library. Blockbuster movies and film trailer music therefore tend to suffer worse than speech and gentler music. Your sources may not particularly expose the weaknesses.

With regards pitch, I agree with nm the that original speed-up will have increased pitch and so I used -ota( r... to do the slowdown in my example commandline, as this will lower pitch to what I assume is original level. -soundtouch( r... will slow down preserving pitch of your source. See which sounds best to you.

Although native linux feels good, I suspect the two-phase process will be much slower than BeSweet under Wine. I remain convinced, however, that achieving this with native apps is well within the realms of possibility, if you desire to do so.

Last edited by Nick; 10th June 2010 at 14:00.
Nick is offline   Reply With Quote
Old 10th June 2010, 14:05   #6  |  Link
bernd_b
Registered User
 
Join Date: Jan 2003
Location: Germany
Posts: 65
Quote:
Originally Posted by nm View Post
if you're muxing to Matroska, mkvmerge can change the framerate for you.
I suppose this will only work for the video, e.g. h264-stream -but the audio still needs to be reencoded to get a proper length at a proper sample rate?

Concerning sox:
There is an alternative option called "speed" which changes the lenght and the pitch ("like with an magnetic tape"). So there is a choice. Still have to try it anyway and yes - once you get it running beSweet is still a very attractive option. My biggest concern is if audio and video stays in sync - with beSweet, I never had to complain about this. So sox & co will have a hard battle on my pc...

Besides all this my biggest surprise was that reencoding the compressed movie audio tracks is possible at all without noticeable quality loss. My greatest thanks to all these super master coder who supply us with aften, sox, beSweet, ac3enc.dll & Co !!!!

Last edited by bernd_b; 10th June 2010 at 14:20.
bernd_b is offline   Reply With Quote
Old 10th June 2010, 14:12   #7  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by bernd_b View Post
I suppose this will only work for the video, e.g. h264-stream -but the audio still needs to be reencoded to get a proper length at a proper sample rate?
Yes, audio needs to be filtered and re-encoded to have a standard-compliant samplerate.

Quote:
Originally Posted by Nick View Post
Although native linux feels good, I suspect the two-phase process will be much slower than BeSweet under Wine.
If Aften can read the input from stdin or a named pipe, it should be about as fast.

Last edited by nm; 10th June 2010 at 14:16.
nm is offline   Reply With Quote
Old 10th June 2010, 19:37   #8  |  Link
Nick
One click is all it takes
 
Nick's Avatar
 
Join Date: Mar 2002
Location: Heart of the Broad Acres
Posts: 1,404
Quote:
Originally Posted by nm View Post
If Aften can read the input from stdin or a named pipe, it should be about as fast.
Agreed. Haven't tried with sox (yet) but my previous attempts to demux mp3 audio from an avi file to wav via ffmpeg, piping the output directly to aften, resulted in aften closing immediately and a 0 byte AC3 file being produced.

Although I seem to recall reading somewhere recently that sox calculates the supposed output size and writes a valid wav header to a pipe, whereas ffmpeg does not, so some experimentation might be in order.
Nick is offline   Reply With Quote
Old 10th June 2010, 23:18   #9  |  Link
Nick
One click is all it takes
 
Nick's Avatar
 
Join Date: Mar 2002
Location: Heart of the Broad Acres
Posts: 1,404
OK. Well, with Aften, sox and ffmpeg installed from my distro's repositories, the following seem to work:
If your audio is already demuxed to an ac3 file, just use this as ffmpeg's input

Code:
ffmpeg -i /path/to/capture.avi -f sox - | sox -p -t wav -r 48000 - tempo 0.96 | aften -b 224 -readtoeof 1 - output.ac3 ####(slow down retaining pitch) or
 
ffmpeg -i /path/to/capture.avi -f sox - | sox -p -t wav -r 48000 - speed 0.96 | aften -b 224 -readtoeof 1 - output.ac3 ####(slow down with lowering of pitch)
From the sox manual, it says for most uses, tempo seems to be better than stretch, so I've used that.

<edit>only tested with stereo source - may or may not need minor modification for 5.1</edit>

Last edited by Nick; 10th June 2010 at 23:25.
Nick is offline   Reply With Quote
Reply

Tags
ac3, aften, besweet, frame rate conversion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:34.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.