How to convert PCM into Flac

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Icanseestars
Posts: 70
Joined: Sat Mar 07, 2009 10:12 am

How to convert PCM into Flac

Post by Icanseestars » 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)
Last edited by Icanseestars on Mon May 16, 2011 11:10 am, edited 2 times in total.

skittle
Posts: 349
Joined: Thu Jan 14, 2010 4:23 am

Re: How to convert PCM into Flac

Post by skittle » Thu Mar 03, 2011 6:29 am

or just skip the mkvmerge/mkvextract process and use ffmpeg directly, it can even mux everything while transcoding to save time.

cpmame
Posts: 4
Joined: Thu Jun 16, 2011 5:09 am

Re: How to convert PCM into Flac

Post by cpmame » Wed Jun 22, 2011 6:51 pm

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

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh » Wed Jun 22, 2011 9:28 pm

This may work:

Code: Select all

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

cpmame
Posts: 4
Joined: Thu Jun 16, 2011 5:09 am

Re: How to convert PCM into Flac

Post by cpmame » Thu Jun 23, 2011 3:09 am

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

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh » Thu Jun 23, 2011 8:01 am

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.

robpdotcom
Posts: 86
Joined: Thu Nov 11, 2010 5:58 pm

Re: How to convert PCM into Flac

Post by robpdotcom » Thu Jun 23, 2011 2:17 pm

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.

Icanseestars
Posts: 70
Joined: Sat Mar 07, 2009 10:12 am

Re: How to convert PCM into Flac

Post by Icanseestars » Sat Jun 25, 2011 12:43 pm

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.

steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle » Thu Jan 12, 2012 5:43 am

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 :)

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: How to convert PCM into Flac

Post by Romansh » Thu Jan 12, 2012 5:24 pm

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.

paulster
Posts: 194
Joined: Sat Aug 20, 2011 6:54 pm

Re: How to convert PCM into Flac

Post by paulster » Fri Jan 13, 2012 4:12 am

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.

steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle » Sat Jan 14, 2012 8:35 pm

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?

paulster
Posts: 194
Joined: Sat Aug 20, 2011 6:54 pm

Re: How to convert PCM into Flac

Post by paulster » Sat Jan 14, 2012 8:52 pm

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
Last edited by paulster on Sun Jan 15, 2012 2:10 am, edited 1 time in total.

steagle
Posts: 12
Joined: Sat Dec 31, 2011 6:05 pm

Re: How to convert PCM into Flac

Post by steagle » Sat Jan 14, 2012 11:25 pm

Thanks! For Mac OS, it's not liking the double dash before remux. Is there a different command for Terminal users?

paulster
Posts: 194
Joined: Sat Aug 20, 2011 6:54 pm

Re: How to convert PCM into Flac

Post by paulster » Sun Jan 15, 2012 2:11 am

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.

Post Reply