StackOverflowNewbie
StackOverflowNewbie

Reputation: 40633

FFMPEG command for video and audio

I'm not building the next YouTube or iTunes, but I do need to give my users the ability to upload their videos and audios -- then present it on the web at the highest possible quality with the lowest possible file size.

Questions:

  1. FOR INPUT: What video and audio formats should I support? I'm guessing I should try to support the most common formats, but I'm not entirely sure what they are. Also, I'm not sure if I should support the most common formats. Maybe there is a reason not to support a certain format.

  2. FOR OUTPUT: What video and audio output formats should I generate? I'd like to use HTML5's and tags, but know I should consider supporting non-HTML5 browsers. Should I do OGG, MP4 and FLV for videos? What about audios?

  3. Given an unknown video and audio file uploaded by the user, what command should I use to generate the desired output formats. I'd like one command to convert to particular outputs -- and hopefully not have to do anything different to the commands depending on the input (it'll be a pain for me to know what the MIME type is of the file, etc. and can't really do an "if input is a WMV, then run this command" logic).

Suggestion FFMPEG experts?

Upvotes: 0

Views: 833

Answers (1)

blahdiblah
blahdiblah

Reputation: 33991

  1. Support what you actually support. Build FFmpeg with support for as many formats as feasible, and then instead of giving users a list of supported formats just report if FFmpeg choked on their file. Users can (barely) tell what the container format is, and that's not enough information for you to know if you can transcode it correctly.

  2. Use h264 video in an mp4 container, and aac audio in an m4a container. Since the videos are going to be played online, there's no reason to support many formats if one will do. HTML5 and Flash can both play those formats, so don't give yourself extra problems by having numerous output formats apart from the myriad input formats you'll get.

  3. ffmpeg -i <input video file> -c:v libx264 -c:a libfaac output.mp4. Of course that's just a start, and you might well want to adjust the quality (-qscale), bitrate (-b), etc. You'll have to tune the parameters somewhat to fit your needs, sadly there is no single configuration for "highest possible quality with the lowest possible file size."

Upvotes: 2

Related Questions