What's the ffmpeg command to extract WAV from mpegts pcm-bluray audio?

4

1

So I've tried but I can't seem to find the right ffmpeg options to extract the pcm_bluray audio from a mpegts and output a WAV.

Here's ffmpeg's info on the source file:

Input #0, mpegts, from '00009_StickmanValentine.m2ts':
  Duration: 00:04:22.87, start: 599.958344, bitrate: 15951 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR
       16:9], 24 fps, 24 tbr, 90k tbn, 48 tbc
    Stream #0:1[0x1100]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s

Most important I need to keep the audio levels as close to the original as possible. Maintaining the bit depth would be good too, but not mandatory. The source is not encrypted.

If you can suggest a great reference for ffmpeg arguments, I'd appreciate that as well.

John Pilgrim

Posted 2013-03-08T16:40:09.443

Reputation: 63

The best reference I can suggest for ffmpeg arguments is its documentation :)

– slhck – 2013-03-08T20:05:37.580

Doh! I looked a lot of places but not there. Google was leading me on a wild goose chase. Thanks! – John Pilgrim – 2013-03-09T01:09:36.540

Answers

4

Well you left out what you have already tried, so I will assume this has yet to be tried.

ffmpeg -i 00009_StickmanValentine.m2ts b.wav

ref

Steven Penny

Posted 2013-03-08T16:40:09.443

Reputation: 7 294

@evilsoup (1/2) Big-endian actually doesn't mean that it stores some data at the end of the stream. The difference between little-endian and big-endian comes up when you start storing numbers that are too big to store in a single byte. Audio with samples more than 8 bits wide (such as 16-bit or, in this case, 24-bit) uses more than one byte for each sample. You have to decide what order to write those bytes out in. Big-endian puts the bytes that have the biggest effect on the value first, little-endian puts them last. – Jonathan Gilbert – 2018-04-02T03:55:10.220

@evilsoup (2/2) Humans write numbers big-endian, as in "123" means "100 + 20 + 3". Little-endian would be "321" for "3 + 20 + 100". WAV files are technically very flexible, and can store a wide variety of sample formats, but most software working with WAV files doesn't support everything that the file format can do. Most things only support having the samples written out in little-endian order. – Jonathan Gilbert – 2018-04-02T03:55:16.070

That works! Thanks! The following were tried and did not work: ffmpeg -i 00009_StickmanValentine.m2ts -acodec pcm_s24be out.wav ffmpeg -i 00009_StickmanValentine.m2ts -acodec copy out.wav ffmpeg -i 00009_StickmanValentine.m2ts -acodec copy out.aif Looks like I was ovethinking it! – John Pilgrim – 2013-03-09T01:07:31.130

1@John IIRC, pcm_s24be is incompatible with WAV, you'd have to use pcm_s24le. be=big-endian=stores some data at the end of the stream, this is used by AIFF (Apple's equivalent to WAV, though AFAIK all systems support both equally well); le=little-endian=that data is stored at the beginning off the stream. – evilsoup – 2013-03-09T10:16:39.320

2This answer will probably work, but you might find ffmpeg converting the audio to 16-bit (I have no audio DVDs to check with here). This won't actually lead to any quality loss, but if you're buying audio DVDs, I assume you want the 24-bit audio, in which case use -acodec pcm_s24le - or -c:a pcm_s24le in the current ffmpeg syntax. – evilsoup – 2013-03-09T10:19:41.317

1Thanks! This is actually for ripping the audio from BluRay videos, to perform loudness (LKFS) analysis using AudioLeak and Dolby Media Meter. The command given in the original answer produces a file what works in those apps, and which has the following specs per ffmpeg: Input #0, wav, from '/path/to/00009_StickmanValentine.wav': Duration: 00:04:22.83, bitrate: 1536 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s – John Pilgrim – 2013-03-09T20:59:57.070