I'm using ffmpeg to convert various types of video files into mp4s.

The command I use works for most video files I've encountered, however when it encounters an m4v it never stops processing the file. The longest I've let it run is 4 hours on a 10 minute video clip. What's more is that if I let it run long enough the output file will be larger than the input file.

Below is the command in it's entirety. This command also resizes the videos to a standard definition.

/usr/local/bin/ffmpeg -y -i /path/to/input.m4v -y -acodec libfaac -ar 44100 -ab 96k -pass 2 -passlogfile x264-2pass-11164-log -threads 2 -vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -s 720x406 -vf movie=/apps/video_conversion/watermark.png [wm]; [in][wm] overlay=main_w-overlay_w-10:10 [out] -analyzeduration 2000M /path/to/output.mp4 

What am I doing wrong here? I would think that computing between mp4 and m4v would be easy considering how similar these file types are.

I know that you easily convert between mp4 and m4v just by changing the extension. The reason I run it through this command on ffmpeg is because it also needs to be resized to specified format.

  • Which version of ffmpeg and libx264? Update to the latest if possible. Please post the full output too. Does it work if you leave out all the advanced options? Does it work if you just specify -vcodec copy -acodec copy to change the extension but try and rewrite the container? Can you provide the video where it does not work or find a pattern? Doesn't it work for all M4V videos?
    – slhck
    Dec 28 '11 at 22:01
  • It doesn't work for any m4v that i tried. I don't know how to check ffmpeg and libx264 versions but i am running it on a linux server. If you can tell me how to check i can fin that out.
    – aamiri
    Dec 28 '11 at 22:15
  • Which Linux distribution? There are extensive Ubuntu tutorials here, and you will probably have to compile from source.
    – slhck
    Dec 29 '11 at 9:05

Try this:

ffmpeg -y -i INPUT -r 30000/1001 -b 2M -bt 4M -vcodec libx264 -pass 2 -vpre hq -acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4
  • 5
    can you explain why you think this will work? Is this something specific to m4v to mp4 conversions?
    – aamiri
    Dec 29 '11 at 18:35

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.