Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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)
share|improve this answer
    
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]

Example:

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"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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