Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert .flv video into .h264 format with FFmpeg?

I want to convert from .flv to .h264 format.

Problem: I did a conversion from FLV to H264 format but my converted video (.h264) is running so fast (just like we'd click on a fast forward button).

I used the following command:

ffmpeg -i example.flv -sameq -vcodec libx264 -vpre default -ar 22050 output.h264
like image 623
Shishir Mudliyar Avatar asked Oct 17 '12 05:10

Shishir Mudliyar


People also ask

Does FFmpeg support FLV?

FFmpeg is a command line based tools which allows to do very neat video manipulations. We would like to share this small script, which our IT specialists have used for one of our video conversion projects. It parses a directory, finds all flv (Flash video) files and converts them to mp4.

What is libx264 in FFmpeg?

x264 is a free software library and application for encoding video streams into the H. 264/MPEG-4 AVC compression format, and is released under the terms of the GNU GPL. Download x264 master • Source • 750kB. Binaries.


1 Answers

The solution is that you need a container format. Raw h.264 does not have any timing information for a video which is why your player is playing it very fast.

Also your command is all messed up. Do you want audio in your output or not? If yes then you need to specify a container format which will have both audio and video.

Either change your output to a mp4

ffmpeg -i input_file -c:a copy -c:v libx264 -profile:v baseline out.mp4

or some other container. If you want a video only stream remove the audio options and add -an.

If you want to use AAC audio instead of whatever the FLV file has:

ffmpeg -i input_file -c:a aac -strict -2 -b:a 128k -c:v libx264 -profile:v baseline out.mp4

If your ffmpeg does not have the -c or -profile options, update to a more recent version.

like image 143
av501 Avatar answered Sep 28 '22 01:09

av501