I have a MKV video which I want to put in my mobile (a Nokia XM 5800) and based on this I can play H.264/AVC format videos on it. Based on what I have read, the container should be MP4 and I can encode it using XVID codec. The problem is I don't know how.

Since I am using Linux (Arch), I was wondering if I can achieve this using FFMPEG. If so, please enlighten me on how to do this. I want the video to use the native screen size of the device, 640x360, with a reasonably good video and audio quality.

If you can also suggest other tools that will make it easier, please suggest.

I also prefer command line tools over GUI ones.


Avidemux has a useful GUI interface that will let you resize and transcode. mencoder (part of MPlayer) can do it too, but it's also command line.

I think the ffmpeg line you want is something like this:

ffmpeg -s 640x360 -i in.mkv -vcodec libx264 -o new.mp4
  • -s sets the output size
  • -i is input file
  • -vcodec sets the output codec (see ffmpeg -codecs for your full list)
  • -o sets the output filename (see ffmpeg -formats for your full list)
  • Thanks, I will try this out. I forgot to mention that I prefer command line tools over GUI ones [question updated]. – Eric Apr 3 '12 at 23:31

Splitting without re-encoding:

ffmpeg -ss [start-time] -t [length-time] -i [in-file-path] \
       -vcodec copy -acodec copy [out-file-path]


ffmpeg -ss 00:00:00.00 -t 00:10:00.00 -i "/some/path/to/file.mp4" \
       -vcodec copy -acodec copy "/some/path/to/new file.mp4"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.