If I capture the S/PDIF input (sounds like static of course) and have what seems to be called a ddwav file, in Linux, is there any CLI that can convert that audio into ac3? Similar to what besplit can do for Windows?
Someone had mentioned to me ffmpeg might be able to, but, I can find no example anywhere of that. But I can't find anything else.
+ Reply to Thread
Results 1 to 29 of 29
ffmpeg has to be built with a gpl license and have liba52 enabled to convert to .ac3. Aften can also be used but i am unfamiliar with it's CLI interface.
For ffmpeg WinFF is a user friendly and "small" GUI for ffmpeg that is available for most Linux distros. It includes .ac3 presets providing your ffmpeg has the build options mentioned at the beginning of this post.
aften $in $out
If the file is a multichannel wav file, aften will see and encode by default to multichannel ac3.
bash-3.1$ aften -h Aften: A/52 audio encoder Version SVN-r765 (c) 2006-2007 Justin Ruggles, Prakash Punnoor, et al. usage: aften [options] <input.wav> <output.ac3> options: [-h] Print out list of commandline options [-longhelp] Print out commandline option details [-version] Print out the build version [-v #] Verbosity (controls output to console) 0 = quiet mode 1 = show average stats (default) 2 = show each frame's stats [-threads #] Number of parallel threads to use 0 = detect number of CPUs (default) [-nosimd X] Comma-separated list of SIMD instruction sets not to use Available sets are mmx, sse, sse2, sse3 and altivec. No spaces are allowed between the sets and the commas. [-b #] CBR bitrate in kbps (default: about 96kbps per channel) [-q #] VBR quality [0 - 1023] (default: 240) [-fba #] Fast bit allocation (default: 0) 0 = more accurate encoding 1 = faster encoding [-fes #] Fast exponent strategy decision (default: 0) 0 = higher quality encoding 1 = faster encoding [-pad #] Start-of-stream padding 0 = no padding 1 = 256 samples of padding (default) [-w #] Bandwidth 0 to 60 = fixed bandwidth (28%-99% of full bandwidth) -1 = fixed adaptive bandwidth (default) -2 = variable adaptive bandwidth [-wmin #] Minimum bandwidth [0 - 60] (default: 0) [-wmax #] Maximum bandwidth [0 - 60] (default: 60) [-m #] Stereo rematrixing 0 = independent L+R channels 1 = mid/side rematrixing (default) [-s #] Block switching 0 = use only 512-point MDCT (default) 1 = selectively use 256-point MDCT [-cmix #] Center mix level 0 = -3.0 dB (default) 1 = -4.5 dB 2 = -6.0 dB [-smix #] Surround mix level 0 = -3 dB (default) 1 = -6 dB 2 = 0 [-dsur #] Dolby Surround mode 0 = not indicated (default) 1 = not Dolby surround encoded 2 = Dolby surround encoded [-dnorm #] Dialog normalization [0 - 31] (default: 31) [-dynrng #] Dynamic Range Compression profile 0 = Film Light 1 = Film Standard 2 = Music Light 3 = Music Standard 4 = Speech 5 = None (default) [-acmod #] Audio coding mode (overrides wav header) 0 = 1+1 (Ch1,Ch2) 1 = 1/0 (C) 2 = 2/0 (L,R) 3 = 3/0 (L,R,C) 4 = 2/1 (L,R,S) 5 = 3/1 (L,R,C,S) 6 = 2/2 (L,R,SL,SR) 7 = 3/2 (L,R,C,SL,SR) [-lfe #] Specify use of LFE channel (overrides wav header) 0 = LFE channel is not present 1 = LFE channel is present [-chconfig X] Specify channel configuration (overrides wav header) 1+1 = (Ch1,Ch2) 1/0 = (C) 2/0 = (L,R) 3/0 = (L,R,C) 2/1 = (L,R,S) 3/1 = (L,R,C,S) 2/2 = (L,R,SL,SR) 3/2 = (L,R,C,SL,SR) adding "+LFE" indicates use of the LFE channel [-ch_X file] Add a mono file to the input list as the channel specified ch_fl = Front Left ch_fc = Front Center ch_fr = Front Right ch_sl = Surround Left ch_s = Surround ch_sr = Surround Right ch_m1 = Dual Mono Channel 1 ch_m2 = Dual Mono Channel 2 ch_lfe = LFE [-raw_fmt X] Raw audio input sample format (default: s16_le) One of the pre-defined sample formats: u8, s8, s16_le, s16_be, s20_le, s20_be, s24_le, s24_be, s32_le, s32_be, float_le, float_be, double_le, double_be [-raw_sr #] Raw audio input sample rate (default: 48000) [-raw_ch #] Raw audio input channels (default: 1) [-chmap #] Channel mapping order of input audio 0 = WAVE mapping (default) 1 = AC-3 mapping 2 = MPEG mapping [-readtoeof #] Read input WAVE audio data until the end-of-file 0 = use data size in header (default) 1 = read data until end-of-file [-bwfilter #] Specify use of the bandwidth low-pass filter 0 = do not apply filter (default) 1 = apply filter [-dcfilter #] Specify use of the DC high-pass filter 0 = do not apply filter (default) 1 = apply filter [-lfefilter #] Specify use of the LFE low-pass filter 0 = do not apply filter (default) 1 = apply filter [-xbsi1 #] Specify use of extended bitstream info 1 0 = do not write xbsi1 1 = write xbsi1 [-dmixmod #] Preferred stereo downmix mode 0 = not indicated (default) 1 = Lt/Rt downmix preferred 2 = Lo/Ro downmix preferred [-ltrtcmix #] Lt/Rt center mix level [-ltrtsmix #] Lt/Rt surround mix level [-lorocmix #] Lo/Ro center mix level [-lorosmix #] Lo/Ro surround mix level 0 = +3.0 dB 1 = +1.5 dB 2 = 0.0 dB 3 = -1.5 dB 4 = -3.0 dB (default) 5 = -4.5 dB 6 = -6.0 dB 7 = -inf dB [-xbsi2 #] Specify use of extended bitstream info 2 0 = do not write xbsi2 1 = write xbsi2 [-dsurexmod #] Dolby Surround EX mode 0 = not indicated (default) 1 = Not Dolby Surround EX encoded 2 = Dolby Surround EX encoded [-dheadphon #] Dolby Headphone mode 0 = not indicated (default) 1 = Not Dolby Headphone encoded 2 = Dolby Headphone encoded [-adconvtyp #] A/D converter type 0 = Standard (default) 1 = HDCD bash-3.1$
ffmpeg -i $in -ac 6 -ar 48000 -ab 448K $out.ac3Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
Sorry it is not, it's a raw file from S/PDIF in, which is not what you say. I already talked to Justin, aften will not do it.
For a better definition of a ddwav, see this thread:
I see. I mistook what you stated as a multichannel uncompressed wav, rather than an ac3 file with wav header. Which is essentially what you have? Like the hack that used to be done to mp3s. Where they would hack the header of an mp3 file to say it's a wav just to get it to mux with an avi?
Try capturing to an uncompressed format, or not capturing to a file with a wav header. Don't know if that's possible .
Or, decode the the file, then re-encode it.
I did a quick test from this web site ( http://www.diatonis.com/downloads_dts_ac3.html ) on a ddwav file.
sox -c 6 diatonis_invisible_order_anfos_ac3.wav out.wav
aften out.wav out.ac3
Aften: A/52 audio encoder Version SVN-r765 (c) 2006-2007 Justin Ruggles, Prakash Punnoor, et al. input format: Microsoft WAVE Signed 16-bit little-endian 44100 Hz 5.1-channel output format: 44100 Hz 3/2 + LFE SIMD usage: MMX SSE SSE2 SSE3 Threads: 8 progress: 100% | q: 257.2 | bw: 39.0 | bitrate: 448.0 kbps
It should be noted that VLC plays AC3 files with a wav header just fine. Perhaps you could use vlc to decode the file. VLC works from the CLI.Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
That is curious indeed. I thought there were S/PDIF headers in addition that had to be removed (looked through the VLC code and there is more going n than removing the wav headers). The software I use to record forces some sort of non ac3 container, so, wav is the easiest and best. And yes, I know VLC does these files, but, VLC has some issues for me. But, it does work so you are correct, I just want to find something else for my own reasons.
So, I installed sox. I already had aften. I did your process on a DDWAV file from the output of my dvr. Certainly, the output of sox was not playable. So, I ran aften and got an error that said that 6 channel audio must have LFE channel, which is true of course. Indicating there is something wrong with the intermediate file as the source certainly does have an LFE channel.
So, perhaps the sites so called DDWAV file has had some type of processing done on it. I would think it did since it was 44100, and, ac3 output from most sources (certainly my dvr) is 48000. Your input format in aften said 5.1 channel, mine says 6 channel.Steve
Yes, I used those flags for Aften, while it would then "convert", it was still S/PDIF and static.
I uploaded a small 10 second sample here (2MB):
Pick the filename with HBO in it and click the down arrow to download it.
If it does not convert, you will hear static. If it does, you will hear eerie "music" followed by what sounds like wind, I just recorded a random 10 seconds off of HBO. You can play it in VLC, and, you can even see VLC says a52 codec. But, that's because it has special logic for this sort of file, if you look thru the code.Steve
Interesting that VLC will play these files. Learn something new every day.
Don't know if this helps for Linux folks, but AC3Filter was previously the only software I could find which would accurately playback the DDWAV.
This file is NOT an AC-3 file with a wave header, it is an audio copy of a streaming digital file. A very strange duck indeed.
Just so you know, files copies by a 16-bit card sound exactly the same as with a 24-bit, also with incorrect capture settings. The 16-bit or other files will not convert, however.
Darn, I was hoping someone knew of some Linux software other than VLC. I can use VLC if necessary, but, it has so many bugs and limited conversions. So, was hoping there was some other software.
Yes, in Windows, besweet and besplit can also process those, though, maybe not correctly according to your reply.
I did not think it was an ac3 file as is. I saw logic in VLC that was more complex than that. But the files are *very* useful for moving ac3 content off of other systems which have no other way of doing so.Steve
That audio file sounds strange muffled. As if it was captured wrong.
Besweet did the same conversion as sox/aften did on the file you posted, they failed.
Bsplit also fails
BeSplit v0.9b6 by DSPguru.
[00:00:00:000] +------- BeSplit -----
[00:00:00:000] | Input : HBO raw SPDIF.wav
[00:00:00:000] | Source Sample-Rate: 32.0KHz
[00:00:00:000] | Channels Count: 2, Bitrate: 32kbps
[00:00:00:000] | Output Prefix : c:track
[00:00:00:000] | Writing c:track01.ac3
[00:00:00:000] Operation Completed !
[00:00:00:000] <-- Process DurationLinux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
Nope, 32 k, won't work. Gotta be 48K.
Originally Posted by Nelson37
Can you process the file?Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
It plays perfectly under VLC. Exactly like the original. Try it in VLC, you will see. Don't know what besweet or besplit require as I do not run them. I find your report curious, that besweet says it is 32KHz, it is not. No other tool I can find reports that rate.
I've converted hours of content from one file. This was just a 10 second sample. In fact, I've done entire movies and the sound synced perfectly to the separately recorded movie video without any adjustment.
That being said, this 10 second clip IS very odd sounding even when correct. So, I could post the ac3 converted file from VLC, but, youu can just as easily hear it yourself from VLC. It is exactly like the original. It was likely a poor choice of 10 second sample though.Steve
I passed -ac3 instead of -ddwav
I'd wait for sox to get back to you, or run besplit with wine, which works after I pass the correct options.
Is there a way you could capture to raw format with your sound card? Instead of adding RIFF headers to the file?
arecord -t raw -D hw -f S16_LE -c2 -r48000 audio1.rawLinux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
Capturing to raw format won't change anything except the wav header, which will then make it impossible to convert as all the tools I know of require wav for S/PDIF audio. Now I would have a .raw file with all static, and what will convert that to ac3? The format I need in the end is a .ac3 file.Steve
Try it out
Sox, ffmpeg, aften, lame, oggenc, and so on, all handle raw files.
sox -V -r 48000 -w -c 6 -s audio1.raw audio1.wav
[-raw_fmt X] Raw audio input sample format (default: s16_le) One of the pre-defined sample formats: u8, s8, s16_le, s16_be, s20_le, s20_be, s24_le, s24_be, s32_le, s32_be, float_le, float_be, double_le, double_be [-raw_sr #] Raw audio input sample rate (default: 48000) [-raw_ch #] Raw audio input channels (default: 1)Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
I have, and it makes sense it doesn't work as it is not raw audio in the conventional sense. This is not a normal audio file (nor can it be), not even close. It takes special code to handle the optical noise coming in. There is special code, a good bit, in VLC just to handle it, and only from wav. besplit and besweet are the same. It is specific code to handle this specific method. There is no other good way, other than purchasing expensive midi equipment, to get ac3 into the pc. If there is, please share it! But only if you have done it as you will discover it doesn't work the way you think. The link I posted way back in this thread gives a pretty good explanation of the issue, read it. Nelson appears to be the expert. If you have tried to record ac3 via S/PDIF or any other method other than MIDI, you will understand.
So, I am looking for other programs, that run on Linux, that have the required special conversion code in them to handle recorded S/PDIF audio. My guess is there isn't any. Changing the container doesn't help, the actual data in the file has to be massaged. But is it ever wonderful once you get that content offloaded!Steve
Here's how I convert a ddwav.wav file into ac3file.ac3 using VLC Videolan, v. 0.8.6i:
Follow the series of screenshots...
(Note: I use the Windows version, hope this works the same for the Linux one!)
Open VLC Videolan, and go File > Wizard
Choose "Transcode/Save to file", then click "Next"
You will be prompted to select your input stream. Click on "Choose" to browse your way to the file.
This window opens. Navigate to the file, then click "OK".
Click the "Next" button.
Don't choose any transcoding options. Click "Next".
For Encapsulation Format, choose "Raw", then click "Next".
Enter an output filename. Click "Choose" to save this output file to a different directory than the location of the input file. Then click "Finish".
If this works, you should have a file called "test.ac3" located in the same directory as the original "ddwav.wav" file. I've recovered the AC-3 audio of the sample the OP linked to, using this method. In the past, I've had ddwav files that Besplit couldn't process, but which could be played - and thus transcoded to "raw" AC-3 format - with VLC.
Thanks for reading, and good luck
Sounds like another way to accomplish this, that makes a total of two I have ever heard of.
For those not familiar with this process, this capture is not a conventional audio file in any normal sense. It is an audio capture of a digital bitstream, sort of like making an audio capture of a data file by recording the sound pulses from a telephone modem. Hence the requirements for 24-bit, "bit-accurate" recording of the SPDIF input, and the unusual post-processing.
Counting the OP, myself, and the other recent poster in this thread that makes a total of 5 people I have seen reporting success in doing this, and that covers a LOT of research over several years on this issue. Several audio cards, including the bleeping M-audio I ordered which had ONE bleeping input which was defective, out of the 10 available, take a wild bleeping guess which ONE did not work - hint, you HAVE to have SPDIF-IN to do this. But I digress.
I got my original info from a thread over at Doom9, the conversion method IIRC came from the creator of BeSweet.
Sfatula, what audio card are you using, and what video recording methods? You describe no synch issues, I found I got a very slight de-synch over time. I used my ATI card to capture an MPG with stereo audio, and a concurrent SPDIF capture with an X-fi card and different software. Had to correct for start times off by a few seconds. Using Vegas, I then compared the visual Waveform display of the two audio files. After matching the beginning, the AC-3 seemed to be slow by approximately one-half second per hour. Just barely enough to be noticeable, without the visual waveform comparison I'm not usre I would have been certain there was a problem. Had to zoom in to see the difference.
Cap source was HD sat channel, video down-sampled thru the Sat HD reciever S-Video port, real-time IVTC on the ATI card, SPDIF in on a Creative X-fi. Apparently the X-fi also supplied stero to the ATI card, I did not expect and was surprised by the MPG having standard audio content, though only stereo. But, this had perfect synch, when I replaced the stereo with the 5.1, there was a very slight and gradual loss of synch.
By the end of a 42-minute series episode, it was barely detectable, but by the end of a 2-hour movie there was no question there was a problem.
What I did was convert the AC-3 to WAV, compare this to the MPG audio, stretch for an exact match, then re-encode with Vegas. AS you might guess, this was a royal PITA, arrived at only after spending a lot of time with the original captures trying to determine if the lip-synch was just a bit off or not. It was damn near subliminal.
There WAS a duplicate key, and if not for the conspiracy of my officers I would have proven this by geometric logic and finally determined who was stealing the strawberries! (The Caine Mutiny).
Thanks for confirming the complexity of the issue Nelson37. Partingshot - yes, I knew VLC did play these, but my post says "other than VLC". I have other uses and things I want to do. If I had a general program like sox that worked for these, then, I could convert the "DDWAV" to say 6 mono AIFF, or whatever I want. Right now, I am sending it through VLC, to AC3, then on to 6 mono wav files, then to Audacity. I just want to streamline this, and, making a single wav output doesn't seem to make Audacity happy when it is > 4GB, it truncates it. I tried around 20 different file formats, and had success with Audacity only with 6 wavs (and I don't want compressed formats). The VLC user interface is ok, but, I want to automate. The user interface doesn't allow 384k ac3 also, which is what I want for 6 channel (and it seems what comes out of my Dish DVR). So, you then have to use command line. Command line has some bugs. And so on...
Ok, so, back to Nelson37. Count me as a success. You asked about the sync. You know, the first thing I recorded, I was very surprised there was no slow creep of the audio. It could be I do not remember all I did, as that was the first one and I was experimenting with so many different software packages to find the best way. So, it could be I was wrong. The next 2 140 minute movies I did, there was some creep. It was .3-.4 seconds, which seems to match your predictions on some other threads I believe. So, I stretch it in Audacity. Actually, it's pretty simple and since I can match up sound end to sound start on the original analog recording, it works first try. What I do is record analog audio with video, and, at the same time, I record the DDWAV. So, running two software packages at the same time. When done, I trim off the video beginning and end (extra stuff), and, find beginning of audio and end of audio. I then load the converted digital audio into Audacity, and, simply cut to match the original. It takes a few minutes of manual work only. I then mux it up with the original video, and, I am done.
Now for the surprise, you also asked me what audio card. Well, none (check my profile). I came here to the Linux forum as that is the place to discuss more open software issues (and I work with open source software all day long). I do not actually run Linux, though I manage some Linux machines on the job and on the internet and like it, so I hope I am welcome here (aren't you Windows?). I am actually using, for recording, a paltry Mac Mini. It seems, all Macs that have a Toslink port can record just fine! I have tried with two different models (including a Macbook notebook), all of them work (maybe not all, but all Intel ones I have tried). So, nothing special. That was amazing and unexpected actually. But, it does work (though only some audio recorders seem to record correctly, I find on the Mac, the software makes the difference, the hardware is of course always the same). Most Mac folks are not command line kind of folks from my experience, so, I suspected posting there would do me little good. Then there was the Windows type forums, which are not usually folks that deal with anything but Windows specific software, which does me little good as I do not use Windows. Yes, I know I could but I choose not to. Since Mac is really freeBSD under the hood, and most any package that runs on Linux can also run on freeBSD, the link was obvious. Any command line tool can be Applescripted. As I have it now, I record analog audio and video, and ac3. I click on an Applescript (for now, I am putting in a "folder action" script that will also even do this step as soon as the recording is done), and it does all the steps to convert and extract and demux and so on to the point I bring into Audacity, Pretty streamlined, runs for a bit but on it's own, and would love to streamline more and do less conversions, though most of them are lossless. The end result is a very nice DVD that I put in my 400 disk player / library. Of course, works for music also. Total manual effort might be 5 minutes. I use many tools like mplayer, ffmpeg, aften, etc.
So, I have a Dish DVR, and a Mac Mini PVR running EyeTV. Hopefully, future products will make all of this easier. Though I do not have HD input from the Dish to EyeTV, for me, the audio makes the movie, not the video. The video is quite good, just not HD. The audio is out of this world. And that's what I like.
I was surprised you have not found many people with success at this. I had no idea. What I don't get is why more people are not interested, searching the net, provides very little. Very curious, perhaps most people are video people, I am all audio. It's amazing reading post after post from people who don't mind 2.0 audio. I guess I am the oddball. 8)Steve
Interesting the MAC does this so easily, always knew they'd be good for something.
Yeah, I'm a Windows guy. Actually I go back to DOS 2.0.
Exactly which file do you load in Audacity, DDWAV (don't think so), AC-3, or AC-3 converted to 6 mono Wav files?
Will Audacity, or anything else you've heard of, show a visual waveform for an AC-3 file?
My MPG+Stero and SPDIF caps are started seperately, so I have neither a matching end or beginning, that's why I need the visual display. I got the Vegas method to work reliably and pretty much quit looking for something else.
A prog which would show a waveform for, and ideally play, an AC-3 while at the same time doing the same for a standard WAV file, even better a demuxed MP2, would be just peachy keen. If it could do that with the full MPG video and audio, AND the AC-3, I might just keel over on the spot.
First I didn't even have an amp that would do AC-3, then no surround speakers, then the Domestic Coordinator wouldn't let me stretch the wires across the living room. Got the Amp, got the speakers, DC is gone, downside is now the accomodations are smaller and the HD Sat service no longer affordable. Such is life. Getting set to do the same thing with OTA HD captures.
Good surround, and audio quality in general, really does add a lot to a good movie. I got interested in this just to continue a general quest to see how good it could get, compared to commercial DVD. Same reason I started capping the Closed Captions to make subtitles, though these actually have some educational value for my 10-year old.
Then there's this crazy idea involving multi-angle video and Computed 3-D viewing..... Don't laugh, I actually had one of the first consumer cards able to display full-color JPG and remember the guy telling me that "someday, we'll actually be able to display a series of these fast enough to simulate motion".
Ok, I also need visual, mine start almost at the same time, but as you know, almost is not good enough. That's why I use Audacity, it shows the 6 channel waveforms. And, the 2 analog audio (demuxed MP2) so that I can easily match it up. My beginning and end do not match for both files, I simply take the silence before the movie or show, and, offset it back. So, if MP2 audio starts at 7.321 secs (first sound), I find the same sound in the 6 channel, and, subtract 7.321 seconds and cut there. I do the same for the end. Then, I extend (change tempo) based on where the sound ends on each to match that up. So, the final recording ends up the same length. Which means it should match exactly the video. And it does. It's pretty simple. This is the only manual part of my process. The fact that it works even on the mini is great, since a mini more than easily fits in my A/V system rack without taking hardly any space since it is so very small and uses hardly any power as well.
No, it can not read in ac3 file, that's why I have to use 6 mono wav files (to get around the 4gb limit for wav, unfortunately, Audacity enforces it on input, but not output.) Most stuff I have converted goes above 4GB. Though I have looked, I could not locate an ac3 editor. Internally, it would probably convert anyway if I did find one. One can pipe input to Audacity, making it appear that it can edit ac3 I suppose, haven't messed with that and don't see a real reason to since it's nothing more than smoke and mirrors. Of course, Audacity is open source, and I suppose I could modify it to read DDWAV files (and maybe donate the code to them), but, I don't think it is worth the effort right now. Being open source, it would then work on Windows, Mac, Linux, whatever. Sorry to hear you can't do the HD sat any more. The problem with antenna and those HD channels is of course they are network, meaning, commercials, which means more work of course. The upside is EyeTV records the DD sound from antenna or cable with no extra work. Still, I don't like that for movies with the whole commercial cutting work, never looks the same with those transitions. But, I did make a nice 5.1 DVD for the Olympics opening ceremony for example.
I think mine look as good as a commercial DVD, what do you think of yours? They certainly sound the same.Steve
Sounds like pretty much the same process as I do in Vegas. I bought this a few years back purely for the standards-compliant AC-3 encoder.
I don't think the DD-WAV is editable, I think it can be cut but definitely not stretched.
There is a prog called DelayCut which can cut an AC-3, and seems to indicate it can stretch one though I never got the stretch to work.
I did do one or two with commercial breaks, IIRC it was CutterMaran which could cut an MPG and 6 waves without re-encoding. MPEG2CUT2 can cut an MPG with muxed AC-3. Only did a few of these.
As for matching commercial DVD, yeah, I think I got there, in fact exceeded some. I usually don't bother much with menus and printable disks of good quality are usually not in stock, but IMO definitely a homebrew disk can rival a Hollywood product.