[MEncoder-users] Repacking Without Transcoding
Gordan Bobic
gordan at bobich.net
Thu Nov 6 21:22:03 CET 2014
On 11/03/2014 10:00 PM, Moritz Barsnick wrote:
> 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
Thanks for the hints. I wrote a short script that uses
mplayer -ao null -vo null -really-quiet -identify -frames 1
to get some basic info on the files, and apply transcoding using ffmpeg
only when necessary.
Thank you again for pointing me in the right direction.
Gordan
More information about the MEncoder-users
mailing list