Matt Wolin
Matt Wolin

Reputation: 701

How to Convert MP4 Video File to F4V Using FFMPEG

I am trying to convert an MP4 video file into an f4v video file so that I can stream the video with Flash Media Server. Ideally, I would like to convert the mp4 into various bitrates, so that I can accomplish multi-bitrate streaming of the video. I am pretty sure that ffmpeg is capable of this, but I keep getting different error messages. Here is the latest that I tried:

ffmpeg.exe -i source.mp4 -ar 150 destination.f4v

I am getting the following error message with this: "Unable to find a suitable output format for 'destination.mp4' destination.mp4: Invalid argument

Thanks in advance!

Upvotes: 3

Views: 8780

Answers (2)

Henry
Henry

Reputation: 1459

First, .f4v is not the official extension of F4V video format, at least in the eyes of ffmpeg.

If you want to stream an mp4 file, some implementations of flash players will allow you to seek to a place not yet downloaded. The normal resolution is to convert (actually just repackage) these files in an f4v container.

To convert to f4v that is compatible with streaming, you need to use a FLV metadata injector, such as Yamdi (http://yamdi.sourceforge.net/)

Steps you can take:

ffmpeg.exe -i source.mp4 -vcodec copy -acodec copy destination.flv

This will repackage the video and audio directly into an flv file. FFMPEG will automatically use the f4v format if your input is H.264.

yamdi -i destination.flv -o destination.f4v

After inserting the metadata, your f4v file is now ready for streaming. If you omit this last step, you can only navigate to parts where the file has been download.

FYI, if you can support variable bitrates, use the -crf option. Two-pass encoding will give u a bitrate close to the bitrate you specify, but will take twice the time. Constant rate factor though will give u a constant quality, but you'll probably have to test different values (sane for unperceivable loss: 18 - 24) to get the bitrate you want.

Upvotes: 4

Multimedia Mike
Multimedia Mike

Reputation: 13216

A few notes:

  1. An MP4 file is already suitable for streaming, provided that it contains H.264 for video and AAC for audio. Is source.mp4 already H.264/AAC? If so, no need to transcode to F4V. Speaking of F4V...
  2. An F4V is just an MP4 file with H.264 video and AAC audio. It just happens to have a file extension suggested by Adobe for Flash video. Nothing special.
  3. '-ar 150' is almost certainly not what you want-- this implies 150 Hz. CD-quality audio is 44100 Hz. Did you mean '-ab' to se the audio bitrate? Be advised that that's expressed in bits/second and 150 would still be too low.
  4. Did you copy and paste the error message directly? Because you specified an output of 'destination.f4v' while the error mentions 'destination.mp4'. I can't account for this discrepancy. Perhaps revise the question with the full error output.

Upvotes: 5

Related Questions