How to convert PCM into Flac

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

That worked, thanks. Unfortunately the cleaned mkv still doesn't display a feature list in eac3to :( The file pays back fine in VLC, but because of that LPCM track, I can't get any audio via my receiver & Popcorn Hour. Guess ffmpeg is my last option.
Romansh
Posts: 873
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh »

If you want to extract the audio to a file using a GUI, this *might* work:

http://www.macupdate.com/app/mac/23764/imkvextract
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

That worked! :D With iMkvExtract I was able to extract just the PCM track, which created a file with a .??? extension in Mac OS. I then renamed the extension to .wav and was able to encode to other formats. Thanks for the tip!
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

Bummer, I'll have to take that back... I didn't test the file thoroughly when I posted that. MKVExtract did extract the PCM track successfully, but after encoding to DTS-HD MA with the same number of channels (in this case it was 1.0 Mono), I just get garbled noise in the remuxed MKV. It probably has to do with the fact that I added the .wav extension to the extracted PCM track. But without giving it a usable extension, Windows wouldn't recognize the original file at all and thus the DTS encoding suite wouldn't load it. Anyone else have any experience with these sets of programs?
Romansh
Posts: 873
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh »

Can you post the MediaInfo report for the extracted audio track?
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

General
Wave: 613 MiB, 1h 51mn
1 Audio stream: PCM

Audio
768 Kbps, 48.0 KHz, 16 bits, 1 channel, PCM
Romansh
Posts: 873
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh »

For LPCM Mono or Stereo, MakeMKV defaults to storing raw PCM rather than WAV-in MKV - so mkvextract's output will also be raw PCM, not WAV. You'll have to convert it to WAV somehow before loading it in other software.

Example FFmpeg/Libav usage:

Code: Select all

ffmpeg -i input.mkv -vn -sn -c:a copy output.wav

Code: Select all

avconv -i input.mkv -vn -sn -c:a copy output.wav
Where input.mkv is the path to MakeMKV's output and output.wav is the desired output path for the WAV file.
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

Thanks Romansh! I'll give that a try soon. I know I should have just bitten the bullet and used ffmpeg to begin with. These GUIs are always lacking one or two things that I want to do. Wouldn't it be nice if there was one program that combined the best MakeMKV, mkvtoolnix, tsmuxer, eac3to and ffmpeg features together in one simple, attractive GUI - now that I would pay big bucks for.
angelgraves13
Posts: 91
Joined: Thu Jun 06, 2013 9:36 pm

Re: How to convert PCM into Flac

Post by angelgraves13 »

I prefer LPCM to DTS-HD MA, but to each his own.
steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle »

Neither of my Popcorn Hours (A-200 and C-200) support LPCM playback so any time I encounter a BD title with LPCM it has to be converted to a lossless format. DTS-HD MA is nice as it's supported on all modern receivers. I'm fine with FLAC too, but since I have the DTS-HD encoder I just use that.

Romanash - Just wanted to say thanks again - I was able to successfully transcode the LPCM stream to WAV using your ffmpeg command. Then I converted the WAV to DTS-HD MA using DTS-HD Master Audio Suite Encoder. Finally I muxed the DTS-HD MA track into the original MKV using mkvmerge. A little time consuming, but great to know how to do this for future BD's.
ultradj83
Posts: 2
Joined: Sun May 22, 2016 5:55 am

Re: How to convert PCM into Flac

Post by ultradj83 »

Dears,
I'm trying to rip a Bluray Audio disc to FLAC.
This disc contains a video track just showing titles and a 96kHz 24bits 5.1 channels LPCM audio track.
There's only 1 title splitted in 9 chapters, each one containing a song as usual, and here's the issue.
I want to rip each song to a FLAC file, but chapter markers are only seen by players (ex. VLC, Media Player Classic, etc.), while any rip software (ex. Handbrake, MakeMKV) sees a single chapter.
I'm not in touch with Bluray structures, but I've always been able to rip Bluray disc, all the times but this.
On this disk the structure is in the IISVPL/00000.vps file containing this:
[INDENT]MPLS0100 : ¦ 8 h `00000M2TS ›üÀ øðç > A €deng eng Ž
›üÀÿÿ ý¹úÿÿ D^Yÿÿ ‚Z ÿÿ Ñûÿÿÿ ì jÿÿ |þRÿÿ ì ÿÿ iŠöÿÿ CD4ÿÿ PLEX D Þ ÿÿ ( #& Yes - Fragile (multiAVCHD) –
( #&
00:00:00 ÿÿÿÿ ( #&
00:08:35 ÿÿÿÿ ( #&
00:10:18 ÿÿÿÿ ( #&
00:11:48 ÿÿÿÿ ( #&
00:19:57 ÿÿÿÿ ( #&
00:20:35 ÿÿÿÿ ( #&
00:24:06 ÿÿÿÿ ( #&
00:26:48 ÿÿÿÿ ( #&
00:29:50 ÿÿÿÿ ( #&
00:41:20 ÿÿÿÿ $ [/INDENT]


How can I rip any chapters to the related FLAC file?

Thanks and best regards.
Woodstock
Posts: 9892
Joined: Sun Jul 24, 2011 11:21 pm

Re: How to convert PCM into Flac

Post by Woodstock »

If it were a DVD, you could manually specify that it rip by chapter, but that's not available for BD at this point.

Were I doing this, I would go ahead and rip the entire file to MKV, then use an application like Audacity to export the individual songs to their own file. This actually allows better precision than chapter markers.
MakeMKV Frequently Asked Questions
How to aid in finding the answer to your problem: Activating Debug Logging
paulster
Posts: 200
Joined: Sat Aug 20, 2011 6:54 pm

Re: How to convert PCM into Flac

Post by paulster »

MKVtoolnix can split by chapter. So you can use MakeMKV to generate the MKV file and MKVtoolnix to split into chapter files. Then use something like eac3to to pull the FLAC files out of each chapter MKV.
spl147
Posts: 295
Joined: Mon Dec 10, 2012 4:59 pm

Re: How to convert PCM into Flac

Post by spl147 »

Icanseestars wrote:
Mon Feb 28, 2011 8:32 pm
There are a handful of movies out there that don't contain any TrueHD or DTS-MA audio track but have a high definition PCM audio track which various media players will have problems with. You can convert the audio stream into lossless Flac to improve compatibility, this will also work on TrueHD and DTS-MA also if you wish to move away from those codecs but keep audio quality.

1) Rip movie with MakeMKV taking only the PCM audio track.
2) Download FFmpeg binary and open a command prompt (in windows hold shift then right click on the folder).
4) Enter in ffmpeg -i filename.mkv -acodec flac filename.flac
5) Start MKVmerge and add both the original mkv file and your new flac audio track to mux a new file

No more problems after that, hope that helps some others who ran into this problem.

(Thx skittle for tip)
or just add the following to you makemkv profile and do it all at once:

Code: Select all

    <!-- Save multi-channel LPCM as FLAC -->
    <trackSettings input="LPCM-multi">
        <output outputSettingsName="flac-fast"
                defaultSelection="$app_DefaultSelectionString,+sel:true">
        </output>
    </trackSettings>
dmdmmatt4
Posts: 11
Joined: Tue Dec 05, 2023 8:06 pm

Re: How to convert PCM into Flac

Post by dmdmmatt4 »

I did find some scripts online which can use ffmpeg to split out a single source file into per-chapter audio data, but again it's pretty tedious. What we have with all the auto-ripping and tagging stuff in audio CD land is sorely lacking in DVD/BD media land. There's not even a database that I'm aware of that can tell you which track to rip from a particular disk to ensure you always reliably get the "main feature".

This uses ffprobe and ffmpeg on the linux CLI:

Code: Select all

#!/bin/sh -efu

input="$1"
ffprobe \
    -print_format csv \
    -show_chapters \
    "$input" |
cut -d ',' -f '5,7,8' |
while IFS=, read start end chapter
do
    ffmpeg \
        -nostdin \
        -ss "$start" -to "$end" \
        -i "$input" \
        -c copy -vn \
        -map '0:1' \
        -map_chapters -1 \
        "${input%.*}-$chapter.${input##*.}.wav"
done
Post Reply