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

5,974

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

Share:
5,974

Related videos on Youtube

John Pilgrim
Author by

John Pilgrim

PRIMARY: Film and Video Color Correction, Online Editorial and Visual Effects SECONDARY: Design and Fabrication of Cinematographic Motion Control Hardware and Software TOOLS: DaVinci Resolve, Nuke, Houdini, Final Cut Pro, Avid, After Effects, Solidworks, Python, C, XML/XSL, Arduino

Updated on September 18, 2022

Comments

  • John Pilgrim
    John Pilgrim almost 2 years

    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.

    • slhck
      slhck over 11 years
      The best reference I can suggest for ffmpeg arguments is its documentation :)
  • John Pilgrim
    John Pilgrim over 11 years
    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!
  • evilsoup
    evilsoup over 11 years
    @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
    evilsoup over 11 years
    This 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.
  • John Pilgrim
    John Pilgrim over 11 years
    Thanks! 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
  • Jonathan Gilbert
    Jonathan Gilbert about 6 years
    @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
    Jonathan Gilbert about 6 years
    @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.