Page 1 of 2

How to convert PCM into Flac

Posted: Mon Feb 28, 2011 8:32 pm
by Icanseestars
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)

Re: How to convert PCM into Flac

Posted: Thu Mar 03, 2011 6:29 am
by skittle
or just skip the mkvmerge/mkvextract process and use ffmpeg directly, it can even mux everything while transcoding to save time.

Re: How to convert PCM into Flac

Posted: Wed Jun 22, 2011 6:51 pm
by cpmame
Can you be more specific with the ffmpeg shortcut? Here is my mkv content

filename = movie.mkv
track01 - main video/movie
track02 - ac3 5.1 audio track
track03 - pcm 5.1 audio track
track04 - subtitle

How do you transcode track03 to flac format and mux it back at the same time with ffmpeg? Thanks

Re: How to convert PCM into Flac

Posted: Wed Jun 22, 2011 9:28 pm
by Romansh
This may work:

Code: Select all

ffmpeg -i movie.mkv -vcodec copy -acodec copy -acodec flac -ac 6 -scodec copy output_file.mkv

Re: How to convert PCM into Flac

Posted: Thu Jun 23, 2011 3:09 am
by cpmame
wow good god! how did you get that? I had been reading the official guideline but I never get that kind of insight... wow u guys are really smart... thanks

btw, I also find that after converting pcm -> flac audio, (command = ffmpeg -i pcm_track.mka -acodec flac flac_track.mka) the resulted flac track is downsampled from 24-bit to 16-bit... is that a problem? is there anyway to preserve the 24-bit? or does it really matter here?

thanks

Re: How to convert PCM into Flac

Posted: Thu Jun 23, 2011 8:01 am
by Romansh
cpmame wrote:is that a problem?
Other than reduced audio quality, no.
cpmame wrote:is there anyway to preserve the 24-bit?
TBH I have no idea.

Re: How to convert PCM into Flac

Posted: Thu Jun 23, 2011 2:17 pm
by robpdotcom
You should use eac3to to convert LPCM to flac. It will do a full lossless conversion.

The easiest way is to rip the movie with MakeMKV > use eac3to to convert LPCM to flac > remux with mkvmerge. You can use eac3to in command line, or there are a few GUI's.

Re: How to convert PCM into Flac

Posted: Sat Jun 25, 2011 12:43 pm
by Icanseestars
You can use Staxrip as a UI to eac3to, just set the video to "just mux" so it will copy the stream, it will retain subtitles and chapter data from the original mkv file too. You will have to create a Flac profile in the audio section and you can do 24-bit Flac.

Re: How to convert PCM into Flac

Posted: Thu Jan 12, 2012 5:43 am
by steagle
Hey guys, sorry for bumping an old thread, but I'm in desperate need of help. I've got a particular MKV that contains a LPCM track, and I've never had trouble before now in using the HdBrStreamExtractor GUI for eac3to to extract a LPCM track to separate WAV files. However this particular MKV simply will not load in any of the eac3to front ends, so I'd like to try and use ffmpeg. But I am a total noob with it and not sure how to even get to the point where I can run commands, because I'm not sure how to install it or use it. The ffmpeg website itself seems geared towards developers and coders and simply beyond my understanding. Can someone simplify what I need to do to get this working? Many thanks :)

Re: How to convert PCM into Flac

Posted: Thu Jan 12, 2012 5:24 pm
by Romansh
File information:

Code: Select all

ffmpeg -i /path/to/mkv/file
Extract first audio track to a single wav file:

Code: Select all

ffmpeg -i /path/to/mkv/file -vn -sn -acodec copy /path/to/output/file.wav
eac3to should be able to split that, I think.

Re: How to convert PCM into Flac

Posted: Fri Jan 13, 2012 4:12 am
by paulster
steagle wrote:However this particular MKV simply will not load in any of the eac3to front ends
I've encountered this before. Try running mkclean --remux <mkv file> and then use eac3to against the cleaned file.

mkclean is a free download.

Re: How to convert PCM into Flac

Posted: Sat Jan 14, 2012 8:35 pm
by steagle
Thanks guys, but I'm kind of back where I started, in not being familiar with how to build/install these programs in order to run them at the command line. I'm a front end kind of guy what can I say :oops: Paulster, if you wouldn't mind could you explain how to install Mkclean?

Re: How to convert PCM into Flac

Posted: Sat Jan 14, 2012 8:52 pm
by paulster
You can download mkclean from http://www.matroska.org/downloads/mkclean.html

It doesn't need installing, just extracting to a folder.

So, if for example, you extract it to C:\TEMP then you'd do the following to clean it:

Start -> Run -> cmd (this will bring up a DOS prompt)
cd \<folder where your mkv file is> e.g. cd \mkvs\newmovie
c:\temp\mkclean --remux <mkv filename>.mkv

This will give you a second mkv file called clean.<original filename> in the same folder.

If your mkvs are on a different drive then the first command after opening the DOS prompt will be the drive letter followed by a colon, so for instance if the mkvs were on drive F: then you'd type the following:
Start -> Run -> cmd (this will bring up a DOS prompt)
F:
cd \<folder where your mkv file is> e.g. cd \mkvs\newmovie
c:\temp\mkclean --remux <mkv filename>.mkv

Re: How to convert PCM into Flac

Posted: Sat Jan 14, 2012 11:25 pm
by steagle
Thanks! For Mac OS, it's not liking the double dash before remux. Is there a different command for Terminal users?

Re: How to convert PCM into Flac

Posted: Sun Jan 15, 2012 2:11 am
by paulster
I'm not familiar with MacOS but I just noticed the mistake in my post (now corrected) that I left a space after the double dash. There shouldn't be; it should be --remux.

Hope that helps.