LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Audio track extension problems (https://www.linuxquestions.org/questions/linux-software-2/audio-track-extension-problems-449999/)

leosgb 05-30-2006 03:26 PM

Audio track extension problems
 
Hi,

I am trying to extract audio streams of my DVDs so I can burn them on a CD and take it to my car. I read many threads here and in some other forums with solutions for this problem but they all dont seem to work.

I have transcode and mplayer installed and I read these:
http://www.togaware.com/linux/survivor/DVD_Sound.html
http://www.bunkus.org/dvdripping4lin...ftware_mplayer
http://www.transcoding.org/cgi-bin/t...nly_Processing
http://wiki.clug.org.za/wiki/Ripping_DVDs_with_Mencoder
http://archives.free.net.ph/message/...3bb0e2.en.html

In general the files dumped by transcode have 0 size. So I am trying the last resource right now. I am using mplayer but this process takes too long. It playback the file and dump the audio part to a wav file that consumes a huge amount of disk space. The successful command (still under test) was:
mplayer dvd://1 -aid 129 -vo null -ao pcm:file=track.wav

Is there a way to extract the mp3 stream? I have the extra space to extract the wav file but it is taking a long time (30 minutes and still counting).

If anyone knows any way to extract the audio file to a convenient format that can be easily transfered to a CD-R I would be grateful.

Thanks for any help,

---EDIT:
The title was "Audio track extraction problems" sorry for the mistake

acid_kewpie 05-30-2006 03:34 PM

How do you figure that this is a success story? please choose your forum more carefully before posting next time.

btw. check the -dumpaudio option from the manpage.

XavierP 05-30-2006 03:39 PM

Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your thread/question get the exposure it deserves.

David the H. 05-30-2006 05:16 PM

Here's how I've extracted streams before. All you need is decss and the transcode tools.

Code:

tccat -i /dev/cdrom -T 1,1-4 | tcextract -t vob -x mp3 -a 0 > file.mp3
tccat extracts the vob file, with "-T 1,1-4" being the title number and the track range to extract. Use "-1" instead after the comma to extract the entire title. (You can use lsdvd to get out the title info from the disk.)

This then gets piped into tcextract, which extracts the audio track from the vob. "-t" tells it that it's a vob, "-x mp3" is the type of stream, naturally (some files may be mp2 or ac3 instead), and "-a 0" is the audio stream number.

Note, this gives you the raw audio stream. If you want to convert it to something else you'll have to process it separately with a different program. You can also use the same format to extract video streams.

If for some reason it doesn't work right, you can break it up. Just pipe the tccat output to a file instead and run tcextract on it afterwards. Read the man files for more.

HTH.

leosgb 05-30-2006 05:26 PM

Thanks David, I am trying it right now and will post back with the results I get here.

leosgb 05-30-2006 05:37 PM

Ok, the first command returned a 4GB file to my hard drive:
tccat -i /dev/cdrom -T 1,-1 > temp_arch

Then I tried the rest:
tcextract -i temp_arch -t vob -x mp3 -a 0 > track.mp3

But the track.mp3 has 0 bytes. Does it mean that the track isnt mp3? How can I find out what is the file from the header? And suppose it is AC3. How can I convert it to mp3?

Thanks!

David the H. 05-31-2006 01:18 AM

Yes, I think the problem is that you have the wrong audio type. Most discs I've seen are encoded in ac3. "lsdvd -a" will give you the details about the audio tracks. Make sure you have the right one. Try stream 1 instead of 0, for example.

For conversion, I would probably use sox, or another standalone mp3 encoder. You can do it through transcode, but I don't remember the exact commands off the bat. I think transcode has to pipe it through another program in any case.

I get the feeling that you are mostly just choosing the wrong options somewhere. I'm certain that once you get the inputs all sorted out, you can go back to doing it all at once with transcode, such what your first link spells out.

acid_kewpie 05-31-2006 01:38 AM

ahhh gotta love lsdvd ehh ;-)

personally i'd do this with mplayer still, transcode is so obscure...

you could easily use mencoder to encode an audio only avi file and then suck the stream out a la here: http://www.linuxquestions.org/questi...ad.php?t=75291 (funny when you find yourwself on google huh? :D) or you could even use mplayer -dumpaudio and send it to an existing named pipe via the -dumpfile option. before starting that though, start off lame reading from the named pipe and writing out mp3 file. so once you start mplayer you squirt the data directly into lame.

David the H. 05-31-2006 02:53 AM

That's the thing, isn't it? There are so many different ways you can do the same thing. Personally, I don't find transcode all that mysterious. You just have to realize that it takes the input from one program, converts it to a raw standard, then feeds that into an output program. I suppose mencoder on its own might be easier, but I could never get through the man file to figure it all out :)

Anyway, here's one way to convert straight from the raw vob to mp3 with transcode. There may be better ways, I didn't spend too much time on this. I just set it up to output a bog-standard mp3. It's a bit slow:

Code:

transcode -i input.vob -a 0 -y null,lame -b128 -E 44100 -o outputfile
You need sox and lame installed for it to work. Note that there's no file extension on the output. Transcode will add it for you. Actually, you can put just about any file with audio in the input and it should detect it automatically. It discards any video or other stuff it finds.

Or straight from the dvd with the -T title selector:

Code:

transcode -i /dev/dvd -T 1,-1 -a 0 -y null,lame -b128 -E 44100 -o outputfile

leosgb 05-31-2006 10:45 AM

David,

I am trying the later command "transcode -i /dev/dvd -T 1,-1 -a 0 -y null,lame -b128 -E 44100 -o outputfile" and will post back once it is completed.

I did a "lsdvd -a" and this is what I got:
Title: 01, Length: 01:53:33.220 Chapters: 20, Cells: 20, Audio streams: 01, Subpictures: 00
Audio: 1, Language: xx - Unknown, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 6, AP: 0, Content: Undefined, Stream id: 0x80

Thanks for your assistance.

Hi Acid,

I tried with mencoder too and I got the same results. Since I found many resources for trascode I will give it a try for now. The -dumpaudio option dumped a 0 bytes file too. Based on the lsdvd -a that the dvd presents, do you know how to use mencoder to extract the audio track?

Thanks for your time.

leosgb 05-31-2006 11:12 AM

Unfortunatelly it didnt work again. But at least the output.mp3 file generated has 1252 bytes! When I try to play it though it says that the length is 0 seconds :(

The output for the command was:
[transcode] (probe) suggested AV correction -D 0 (0 ms) | AV 0 ms | 0 ms
[transcode] auto-probing source /dev/dvd (ok)
[transcode] V: import format | MPEG-2 DVD NTSC (V=dvd|A=dvd)
[transcode] V: AV demux/sync | (2) initial MPEG sequence / enforce frame rate
[transcode] V: import frame | 720x480 1.50:1 encoded @ 16:9
[transcode] V: bits/pixel | 0.217
[transcode] V: decoding fps,frc | 23.976,1
[transcode] V: Y'CbCr | YV12/I420
[transcode] A: import format | 0x2000 AC3 [48000,16,2]
[transcode] A: export format | 0x55 MPEG layer-3 [44100,16,2] 128 kbps
[transcode] V: encoding fps,frc | 23.976,1
[transcode] A: bytes per frame | 8008 (8008.000000)
[transcode] A: adjustment | 0@1000
[transcode] V: IA32/AMD64 accel | sse3 (sse3 sse2 sse 3dnowext 3dnow mmxext mmx asm C)
tc_memcpy: using amd64 for memcpy
[transcode] V: video buffer | 10 @ 720x480
[import_dvd.so] v0.4.0 (2003-10-02) (video) DVD | (audio) MPEG/AC3/PCM
[export_lame.so] v0.0.3 (2003-03-06) (audio) MPEG 1/2
[export_null.so] v0.1.2 (2001-08-17) (video) null | (audio) null
[import_dvd.so] tccat -T 1,-1,1 -i "/dev/dvd" -t dvd -d 0 -L | tcdemux -a 0 -x ac3 -S 0 -M 2 -d 0 | tcextract -t vob -x ac3 -a 0 -d 0 | tcdecode -x ac3 -d 0 -s 1.000000,1.000000,1.000000 -A 0
[import_dvd.so] tccat -T 1,-1,1 -i "/dev/dvd" -t dvd -d 0 | tcdemux -s 0x80 -x mpeg2 -S 0 -M 2 -f 23.976024 -P /tmp/filejm6h2d -d 0 | tcextract -t vob -a 0 -x mpeg2 -d 0 | tcdecode -x mpeg2 -d 0 -y yv12
[import_dvd.so] delaying DVD access by 3 second(s)
.tc_memcpy: using amd64 for memcpy
..tc_memcpy: using amd64 for memcpy
[decode_mpeg2.c] libmpeg2 0.4.0b loop decoder
[decode_mpeg2.c] libmpeg2 acceleration: none (plain C)
[export_lame.so] cmd=sox -w -s -r 48000 -c 2 -t raw - -r 44100 -t raw - polyphase 2>/dev/null | lame -x --cbr -b 128 -s 44.100 -m j - "outputfile.mp3" 2>/dev/null

clean up | frame threads | unload modules | cancel signal | internal threads | done
[transcode] encoded 0 frames (204412 dropped, 0 cloned), clip length 0.00 s

I am trying "transcode -i /dev/dvd -T 1,-1 -a 1 -y null,lame -b128 -E 44100 -o outputfile" (instead of 0 for the audio track) to see if anything changes. I am not sure but it seems that this time it is going to work because I see some "encoding frames" and the numbers are growing. Hope at last!

Will post back my results.

leosgb 05-31-2006 11:57 AM

It worked now. Thanks David! Now I am looking for tools to edit the mp3 stream to remove clapping and breaks. If you guys have any suggestion to speed up the process I would take them ;)

David the H. 06-01-2006 12:35 AM

Glad to hear you got it worked out. It does seem strange, since the first audio stream is almost always numbered 0. You must have an oddball disk there. Is it a homemade one, by chance?

As for editing, the commandline editor sox is good for removing noise and such. But for cutting out stuff from the middle, Audacity (gui) is probably your best bet.

But you should have told us that you wanted to edit the sound at the beginning. You shouldn't go converting the file to mp3 until AFTER you have made all of your edits. You need an uncompressed wav/pcm file for editing, and Audacity, for example, will just convert your mp3 to wav anyway. Might as well stat from one and avoid the sound degridation that results from multiple compression runs.

leosgb 06-01-2006 01:01 AM

Yeah, I wasnt aware of that. I am using audacity right now to edit the file. The reason I thought about storing it as mp3 was size. I do all the extraction in my server and then I transfer the file over the network to my laptop to do the editing. But I guess I can afford the bigger file. I will use audacity to edit this one first and then I will use transcode and output it to a wav file and go from there.

Btw, the DVD is a home made disk of a tv show so you were right :)

My plan is to burn some cds with the music from the show only and remove all those inconvenient comments between the songs.

Thank you for all your input. It was really useful.


All times are GMT -5. The time now is 01:17 AM.