2

I'm trying to convert a video file from AVI to MP4 but it doesn't seem to play, my code:

exec("ffmpeg -i ".$video." -c:v libx264 -pix_fmt yuv420p -movflags faststart ".$withoutExt.".mp4")

Even plain code:

exec("ffmpeg -i ".$video." ".$withoutExt.".mp4")

Any ideas please and thanks in advance.

5
  • 1
    Paste full console output of the executed command.
    – Gyan
    Dec 23, 2015 at 8:43
  • @Mulvya actually with the plain version, I get Output file #0 does not contain any stream
    – Shina
    Dec 23, 2015 at 8:55
  • Can't diagnose issue without console output. Add -report option to generate a log file.
    – Gyan
    Dec 23, 2015 at 9:25
  • As an alternative, what's in the AVI file? Please edit and paste MediaInfo of the file.
    – LiveWireBT
    Dec 23, 2015 at 17:07
  • The full, complete ffmpeg console output would be more informative than mediainfo output.
    – llogan
    Dec 23, 2015 at 18:21

1 Answer 1

1

You should specify the audio codec, e.g. -c:a libvo_aacenc.

3
  • 1
    1) Not necessary. If not specified, AAC is implicitly effected for MP4 container. 2)The internal AAC encoder is now stable (since Dec 5 build) and preferable to the VO encoder
    – Gyan
    Dec 24, 2015 at 4:14
  • @Mulvya, that depends on the AVI's audio codec and the ffmpeg version. AAC is not an mp4 requirement, you can mux into an mp4 container practically any streaming format. It is true that ffmpeg will default to AAC when your source is a raw stream, but not when the source is already encoded (notwithstanding some subtle differences between ffmpeg versions). The result is a valid mp4 file which can not be played on a player that expects only h.264+aac. I usually prefer to first get the command line fixed, only if it still doesn't work then the OP should go into diagnosing by sending the dumps.
    – avnr
    Dec 24, 2015 at 10:53
  • 2
    Let me repeat for clarity: if no audio parameters are specified and the output container is MP4, then ffmpeg will encode the audio using the highest priority AAC encoder it has. This is not dependent on whether the source audio is PCM/MP3/other. I did not say AAC is a MP4 requirement, am only referring to ffmpeg's behaviour.
    – Gyan
    Dec 24, 2015 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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