I have some video files in the MP4 format and I want to convert them to MPEG format files.
I try to convert with:
avconv -i 1.mp4 -fmp4 -target mpeg /mpeg/1.mpeg
but I get the following error
1.mp4: Invalid data found when processing input
What am I missing in my command?
I encourage you to read the documentation of the tool before using it. Here's what's wrong:
-fmp4
isn't a valid option. Perhaps you meant -f mp4
, with a space, but:
.mp4
and avconv
should parse this just fine-f
before the input file you specify with -i
.-target
only takes the values vcd
, svcd
, dvd
, dv
, dv50
, and not mpeg
. If you want to encode MPEG video, you'll need to choose a video codec with -c:v
. -target
only should be used if you want to target any of the output formats above, in which case avconv
then chooses the proper codecs on its own.That being said we don't know what MPEG video you want. There's MPEG-1, MPEG-2, MPEG-4 Visual, and MPEG-4 AVC, each with different encoders. See avconv -codecs
for a list.
Try something like this:
avconv -i 1.mp4 -c:v mpeg2video -q:v 2 -c:a libmp3lame output.mpg
I explicitly specified MPEG-2 video here, with variable quality encoding. The quality factor -q
can be set from 1 to 31, with 1 being the best quality. 2–5 is a good range to try. MP3 audio is optional, but it always helps explicitly specifying the codecs you want rather than having avconv
choose defaults.
Also, when asking questions about Libav or FFmpeg, please always include the full, uncut console output, not only the error messages you think are relevant. Otherwise, troubleshooting is much more complicated.