I've a number of downloaded FLV files which I would like to convert to MP4. They are already in the correct format so I am told all I need to do is to remux the video and audio streams into an MP4 container using copy/pass through.

I'm on Windows 7 64 bit and already have FFmpeg as part of get_iPlayer.

I'm struggling to work out the command line for this please?

Also would it be possible to batch process a number of FLV files in the same way?


It should be something like:

ffmpeg -i yourvideo.flv -codec copy output.mp4

You can use FOR command to loop through files (it recurses down your tree):

FOR /R C:\dir\ %%F IN (*.flv) do ffmpeg -i "%%F" -codec copy "%~nF.mp4"

Just to clarify, %~nF returns only the name portion of the filename (without the extension).


They are already in the correct format

.flv videos are complex files that can contain many types of audio and video. To check a .flv file's audio and video codecs you can use:


ffmpeg -i video.flv

which (in your case) should output something along the lines of:

Input #0, flv, from 'video.flv':
  Duration: 00:05:01.20, start: 0.000000, bitrate: 66 kb/s
    Stream #0.0: Video: h264, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 66 kb/s, 29.92 tbr, 1k tbn, 2k tbc 
    Stream #0.1: Audio: aac, 22050 Hz, stereo, s16


2.VLC's Media Information window: VLC's Media Information window for a flv file with AAC and H.264

This .flv file contains H.264 video and AAC audio which happens to be the correct formats/codecs for the .mp4 container.

Here's the structure of such an .mp4 file:

mp4 file containing AAC audio and H.264 video

*Image courtesy of Converting FLV to MP4 With FFmpeg The Ultimate Guide

So when transocding flv to mp4, depending on the codecs in the original .flv file, we have 4 cases:

1) Converting .flv files with H.264 video and AAC audio

If the audio and video codecs in the .flv files are supported by the .mp4 container (AAC + H.264) then you can just copy the streams into an mp4 file without transcoding:

ffmpeg -i video.flv -codec copy video.mp4

Such .flv files are very rare.

This process is MASSIVELY faster than decoding and reencoding the entire audio and video data.

2) Converting .flv files with H.264 video and Nellymoser/Speex audio

If one or more of the videos have H.264 video and Nellymoser ASAO/Speex audio (very common with .flv files) then you need to copy video (-vcodec instead of -codec) and transcode (just) the audio:

ffmpeg -i video.flv -vcodec copy video.mp4

3) Converting .flv files with Spark/VP6 video and Nellymoser/Speex audio

If flv's video and audio data are not encoded with the correct codecs for .mp4 (Spark & VP6 video codecs were very common) then you need to force both AAC and H.264:

ffmpeg -i video.flv video.mp4

4) Converting .flv files with Spark/VP6 video and AAC audio

It would be vary rare to come across a .flv file with AAC audio and video other than H.264, but just in case, here's how to transcode it to .mp4 in the most efficient way (copy the audio data):

ffmpeg -i video.flv -acodec copy video.mp4

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.