[MEncoder-users] Repacking Without Transcoding

Moritz Barsnick barsnick at gmx.net
Mon Nov 3 23:00:11 CET 2014


Hi Gordon,

mencoder is no longer actively developed, and ffmpeg is recommended as
a replacement for most use cases. Especially yours. :-)

On Mon, Nov 03, 2014 at 21:16:16 +0000, Gordan Bobic wrote:
> Unfortunately, the DVDs I've been extracting over time (as the shelf 
> space around the TV has been running out) are mostly in MKV containers 
> with H264 video, which my Chromecasts won't play natively.

I would have expected more from Google, the propagators of WebM, but
there you go. *shrug*

> What I would ideally like to do is extract the H264 video data and 
> repack it into an MP4 container without transcoding (I don't want to 
> lose any video quality and transcoding is CPU expensive while just 
> re-containering should be much cheaper).

Really easy with ffmpeg:

$ ffmpeg -i infile.mkv -c copy outfile.mp4

is usually all there is to it. If you have more than just one video and
one audio stream - so for example multiple audio tracks, or subtitle
streams - you'll have to modify the commandline.

$ ffmpeg -i infile.mkv -sn -c copy -map 0 outfile.mp4

will omit the subtitle streams, but take all available audio (and
video) streams into the target file.

> Also, in many cases, although the video streams I have been encoding are 
> H264, I have mostly been using MP3 audio rather than AAC, so I will need 
> to transcode the audio.

You should check whether MP3 audio isn't accepted first. Otherwise,
modify the above to

$ ffmpeg -i infile.mkv -sn -c:v copy -c:a libfdk_aac -map 0 outfile.mp4

or if you don't have libfdk_aac:

$ ffmpeg -i infile.mkv -sn -c:v copy -c:a aac -strict experimental -map 0 outfile.mp4

More help on using ffmpeg here:
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

Hope this helps,
Moritz


More information about the MEncoder-users mailing list