Agnus Dei (jackal) wrote,
Agnus Dei
jackal

how to convert a mkv to mpeg4-video on macosx

The following instructions will enable you to convert a .mkv file to a .m4v file WITHOUT re-encoding the file. So it takes seconds to convert the format (instead of hours).
-------------

1- Download the binary for ffmpeg ---> http://ffmpegmac.net/

2- Install the binary somewhere on your computer (I put it in /opt/local/binary_downloads ):

3- To convert the mkv file from the command line, just run this command:

$ /opt/local/binary_downloads/ffmpeg -i sample.mkv -vcodec copy -acodec copy sample.m4v 
ffmpeg version 1.0.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec  7 2012 09:31:51 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, matroska,webm, from 'sample.mkv':
  Metadata:
    creation_time   : 1970-01-01 00:00:02
  Duration: 00:02:16.85, start: 0.000000, bitrate: 1935 kb/s
    Stream #0:0(eng): Video: h264 (Main), yuv420p, 720x304, SAR 1:1 DAR 45:19, 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
    Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, s16 (default)
Output #0, ipod, to 'sample.m4v':
  Metadata:
    encoder         : Lavf54.29.104
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 720x304 [SAR 1:1 DAR 45:19], q=2-31, 23.98 fps, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[ipod @ 0x7fc6c18f0e00] st:0 PTS: 67 DTS: -83 < -82 invalid, clipping
frame= 4101 fps=0.0 q=-1.0 Lsize=   32485kB time=00:02:16.84 bitrate=1944.6kbits/s    
video:29531kB audio:2758kB subtitle:0 global headers:0kB muxing overhead 0.603822%


4- I wrote a script to do this:
#!/bin/bash

echo $1
NAME=`echo $1| rev | cut -d. -f2- |rev`
echo $NAME

/opt/local/binary_downloads/ffmpeg -i $NAME.mkv -vcodec copy -acodec copy $NAME.m4v 
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments