Questions tagged [ffmpeg]

Only questions about programmatic use of the FFmpeg libraries, API, or tools are on topic. Questions about interactive use of the command line tool should be asked on Super User or Video Production. FFmpeg is a free, open source project that produces libraries and programs for handling multimedia data.

Questions about interactive use of the ffmpeg command line tool are off-topic. Please ask them on the Super User or Video Production sites.

Questions here should relate to automating or integrating FFmpeg, or usage of the libav* libraries or API. See also: , , .

FFmpeg is a free, open source project that produces libraries and programs for handling multimedia data. The most notable components are:

  • libavcodec – an audio/video/subtitle codec library used by many other projects.
  • libavformat – an audio/video/subtitle container (de)muxing library.
  • ffmpeg – a command line program for transcoding multimedia files.
  • ffprobe – a command line program for viewing detailed information about multimedia files.
  • ffplay - a command line program for playing media files. It is mostly used as a testbed for the various FFmpeg APIs.

FFmpeg is published under the GNU Lesser General Public License 2.1+ or GNU General Public License 2+ (depending on which options are enabled).

See the FFmpeg documentation and FFmpeg Wiki for additional information.

26084 questions
947
votes
14 answers

Cutting the videos based on start and end time using ffmpeg

I tried to cut the video using the start and end time of the video by using the following command ffmpeg -ss 00:00:03 -t 00:00:08 -i movie.mp4 -acodec copy -vcodec copy -async 1 cut.mp4 By using the above command i want to cut the video from…
Kalaiyarasan
  • 12,134
  • 8
  • 31
  • 49
936
votes
31 answers

How to concatenate two MP4 files using FFmpeg?

I'm trying to concatenate two mp4 files using ffmpeg. I need this to be an automatic process hence why I chose ffmpeg. I'm converting the two files into .ts files and then concatenating them and then trying to encode that concatenated .ts file. …
Mark L
  • 12,405
  • 4
  • 28
  • 41
616
votes
13 answers

How can I extract audio from video with ffmpeg?

I tried the following command to extract audio from video: ffmpeg -i Sample.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 Sample.mp3 but I get the following output libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2…
user1269669
  • 6,177
  • 3
  • 14
  • 5
554
votes
16 answers

Rotating videos with FFmpeg

I have been trying to figure out how to rotate videos with FFmpeg. I am working with iPhone videos taken in portrait mode. I know how to determine the current degrees of rotation using MediaInfo (excellent library, btw) but I'm stuck on FFmpeg…
jocull
  • 20,008
  • 22
  • 105
  • 149
389
votes
36 answers

How do you convert an entire directory with ffmpeg?

How do you convert an entire directory/folder with ffmpeg via command line or with a batch script?
Eugene
  • 10,957
  • 20
  • 69
  • 97
362
votes
9 answers

How to create a video from images with FFmpeg?

ffmpeg -r 1/5 -start_number 2 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4 This line worked fine but I want to create a video file from images in another folder. Image names in my folder are: img001.jpg img002.jpg img003.jpg ... How…
user3877422
  • 3,687
  • 3
  • 13
  • 6
338
votes
7 answers

FFMPEG (libx264) "height not divisible by 2"

I am trying to encode a .mp4 video from a set of frames using FFMPEG using the libx264 codec. This is the command I am running: /usr/local/bin/ffmpeg -r 24 -i frame_%05d.jpg -vcodec libx264 -y -an video.mp4 I sometimes get the following…
Andy Hin
  • 30,345
  • 42
  • 99
  • 142
308
votes
15 answers

Convert audio files to mp3 using ffmpeg

I need to convert audio files to mp3 using ffmpeg. When I write the command as ffmpeg -i audio.ogg -acodec mp3 newfile.mp3, I get the error: FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: libavutil …
Hrishikesh Choudhari
  • 11,617
  • 18
  • 61
  • 74
295
votes
3 answers

ffmpeg overwrite output file if exists

I ran: ffmpeg -i input.flac output.mp3 This prompts: File 'output.mp3' already exists. Overwrite? [y/N] y How do I automatically say "yes"?
Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68
260
votes
1 answer

What are the differences and similarities between ffmpeg, libav, and avconv?

When I run ffmpeg on Ubuntu, it shows: $ ffmpeg ffmpeg version v0.8, Copyright (c) 2000-2011 the Libav developers built on Feb 28 2012 13:27:36 with gcc 4.6.1 This program is not developed anymore and is only provided for compatibility. Use…
why
  • 23,923
  • 29
  • 97
  • 142
251
votes
10 answers

How to add a new audio (not mixing) into a video using ffmpeg?

I used a command like: ffmpeg -i video.avi -i audio.mp3 -vcodec codec -acodec codec output_video.avi -newaudio in latest version for adding new audio track to video (not mix). But I updated the ffmpeg to the newest version (ffmpeg version…
Vetalll
  • 3,472
  • 6
  • 24
  • 34
222
votes
10 answers

FFmpeg on Android

I have got FFmpeg compiled (libffmpeg.so) on Android. Now I have to build either an application like RockPlayer or use existing Android multimedia framework to invoke FFmpeg. Do you have steps / procedures / code / example on integrating FFmpeg on…
Jag
  • 2,221
  • 3
  • 14
  • 5
222
votes
8 answers

Best approach to real time http streaming to HTML5 video client

I'm really stuck trying to understand the best way to stream real time output of ffmpeg to a HTML5 client using node.js, as there are a number of variables at play and I don't have a lot of experience in this space, having spent many hours trying…
deandob
  • 5,100
  • 5
  • 25
  • 37
221
votes
9 answers

Fastest way to extract frames using ffmpeg?

Hi I need to extract frames from videos using ffmpeg.. Is there a faster way to do it than this: ffmpeg -i file.mpg -r 1/1 $filename%03d.jpg ?
Stpn
  • 6,202
  • 7
  • 47
  • 94
216
votes
9 answers

Use ffmpeg to add text subtitles

I am trying to add text subtitles to an .mp4 container using ffmpeg: ffmpeg -i input.mp4 -i input.srt -map 0.0 -map 0.1 -map 1.0 output.mp4 When I am trying to run this line, it gives me an error : Nmber of stream maps must match number of output…
0-alpha
  • 3,281
  • 5
  • 20
  • 12
1
2 3
99 100