Questions tagged [ffmpeg]

Media tool with support for multiple codecs, filters, and containers. Include your actual command and the complete console output when asking questions involving FFmpeg tools. An easy way to do this is by adding `-report` to your command and pasting the contents of the logfile generated. For help with CLI use only of ff* binaries - ffmpeg, ffprobe, ffplay. For help with API usage, post on Stack Overflow.

Filter by
Sorted by
Tagged with
88 votes
3 answers

Resizing videos with ffmpeg/avconv to fit into static sized player

I have a html 5 video player which is 700px wide, 400px high. I'm trying to use avconv to use ffmpeg to resize (while retaining the aspect ratio) and making sure it fits into my player. Input can be a ...
  • 1,321
595 votes
13 answers

How do I convert a video to GIF using ffmpeg, with reasonable quality?

I'm converting a video to GIF file with ffmpeg: ffmpeg \ -i input.flv \ -ss 00:00:00.000 \ -pix_fmt rgb24 \ -r 10 \ -s 320x240 \ -t 00:00:10.000 \ output.gif It works great, but output ...
129 votes
10 answers

How to get video duration in seconds?

How can I get video duration in seconds? What I've tried: ffmpeg -i file.flv 2>&1 | grep "Duration" Duration: 00:39:43.08, start: 0.040000, bitrate: 386 kb/s mediainfo file.flv | grep ...
  • 1,647
45 votes
2 answers

Create video with 5 images with fadeIn/out effect in ffmpeg

With 5 images I have to create a video of 60 seconds in ffmpeg, each image has to display for 15 seconds. after 15 seconds, first image has to fade out and 2nd image has to fade in, after that 2nd ...
31 votes
1 answer

What is the "sameq" or "same_quant" option in FFmpeg? Does it mean "same quality"?

Often, I've seen FFmpeg commands using the sameq option, for example ffmpeg -i input.mp4 -sameq output.avi What does this mean? Does it mean "same quality"? If not, what should I use instead?
  • 217k
193 votes
6 answers

How can I normalize audio using ffmpeg?

I want the loudest peak sound in a movie clip to be as loud as the codec allows, then have every other sound amplified accordingly. What's a practical example in order to accomplish this using ffmpeg?...
67 votes
4 answers

Strip metadata from all formats with FFmpeg

How can I remove all metadata from all formats via FFmpeg? I can just set special metadata for each format per man ffmpeg. Any option or method to clear all metadata and strip media from all metadata ...
  • 939
376 votes
7 answers

How to merge audio and video file in ffmpeg

I want to merge an audio file (.wav or .au format) with a video file (.mp4 format). Please suggest me how to achieve this. I want to merge these file to new .mp4 video file. An ffmpeg command would ...
  • 4,319
87 votes
10 answers

How can I remove multiple segments from a video using FFmpeg?

I am trying to delete a few sections of a video using FFmpeg. For example, imagine if you recorded a show on television and wanted to cut out the commercials. This is simple with a GUI video-editor; ...
  • 1,171
555 votes
9 answers

Using ffmpeg to cut up video

I am using ffmpeg to cut out a section of a large file like this: ffmpeg -i input.wmv -ss 60 -t 60 -acodec copy -vcodec copy output.wmv The -ss part works fine but the -t is ignored. It correctly ...
  • 5,679
107 votes
7 answers

Meaningful thumbnails for a Video using FFmpeg

FFmpeg can capture images from videos that can be used as thumbnails to represent the video. Most common ways of doing that are captured in the FFmpeg Wiki. But, I don't want to pick random frames at ...
  • 1,791
99 votes
7 answers

How to rotate a video 180° with FFmpeg?

I have a video that was rotated 180° when recorded. Is it possible to correct this with FFmpeg?
  • 23.5k
43 votes
7 answers

crossfade between 2 videos using ffmpeg

I've been trying to achieve a crossfade transition between 2 video clips using ffmpeg but have failed so far. I'm new to ffmpeg and am mostly relying on tweaking what I can find in the documentation ...
  • 573
12 votes
2 answers

What parameters should I be looking at to reduce the size of a .MOV file?

My Canon 60D creates .MOV files when recording video and I've found out that the .MOV container has an H264 video stream and a PCM audio stream. I've used ffmpeg and GSpot to look at some of my ...
11 votes
1 answer

Video produced from images only plays in VLC but no other players

Within my folder with bunch of 13MP bmp images named 0001.bmp, 0002.bmp,... I run the following commands from command line. Crop images to 4K ffmpeg -i %4d.bmp -vf "crop=3840:2160:184:240" croped%4d....
  • 133
280 votes
14 answers

Combine one image + one audio file to make one video using FFmpeg

This should be pretty trivial, but I can't find a way to get it to work. I want FFmpeg to take one JPEG image and an audio file as input and generate a video file of the same duration as the audio ...
  • 4,030
25 votes
5 answers

How to get time stamp of closest keyframe before a given timestamp with FFmpeg?

I want a FFmpeg seeking command that fast and accurate. I found this. The solution is that we apply -ss for both input (fast seeking) and output (accurate seeking). But: If the input seeking is not ...
  • 377
230 votes
6 answers

Cut part from video file from start position to end position with FFmpeg [duplicate]

I have a video file of 30 minutes, but I want to extract a video from 00:09:23 to 00:25:33. I can define the startposition with -ss, but I couldn't find one for the end position. Any help please?
  • 2,681
49 votes
4 answers

How to cut at exact frames using ffmpeg?

I'm trying to use ffmpeg to cut video files at precise times. The ffmpeg help shows an option -timecode_frame_start to specify the starting frame but I am unable to get this command to work. The ...
  • 935
29 votes
2 answers

FFmpeg command to convert MP3 to AAC

I can issue this command: ffmpeg -i input.mp3 -acodec alac -ab 128k -ar 48000 -ac 2 -y output.m4a to create a m4a file. But when I issue this command ffmpeg -i input.mp3 -acodec alac -ab 128k -...
14 votes
1 answer

What bunch of ffmpeg scripts do I need to get HTML5-compatible "Video for everybody"?

What list of commands should I do in ffmpeg/mencoder/some_other_CLI_app to get a video in all the right formats to use Video for Everybody? i.e. Is there a subtlety that prevents there being a ...
236 votes
11 answers

How can I make ffmpeg be quieter/less verbose?

By default ffmpeg sends a whole lot of messages to stderr: when built, how it was built, codecs, etc, etc, etc. How can I make it quieter? I've tried -v 0 (and -v 10 since the documentation just ...
  • 4,465
89 votes
6 answers

How do I speed up a video by 60X in ffmpeg?

I found this example ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv but I have a video I want to speed up by 60 times, not just 2X.
81 votes
6 answers

Using desktop as fake webcam on linux

I want to make a live stream of (a window on) my linux desktop using a free streaming site, using the captured video as a fake webcam. There are many tools for this on windows. ffmpeg allows me to ...
  • 941
56 votes
4 answers

Best settings for FFMpeg with NVENC

I'm using my FFMPEG with the suport of my GPU (NVENC) to convert files from my satelite receiver (SD, mpeg2 .TS-Files) into h264 .mp4-files Here is the line i'm using ffmpeg -i "e:\input.ts" -vcodec ...
  • 607
38 votes
4 answers

FFmpeg - Apply blur over face

I'm trying to blur a portion of a video using FFmpeg (specifically to blur a face). I have been trying to use a combination of timeline editing and the various bluring filters, but I cannot find a ...
  • 1,540
15 votes
5 answers

Automatically split large .mov video files into smaller files at black frames (scene changes)?

I have 65 .mov video files named,, ..., Each is about 2.5 hours long and takes up many gigabytes. They are digital copies of what were VHS tapes (my family's "...
  • 1,424
4 votes
1 answer

Making ffmpeg process first audio stream differently than all others

I'm trying to write a command such that ffmpeg executes a given instruction for the first audio stream in a file and a different instruction for any and all others. In the test case below, for ...
2 votes
1 answer

ffmpeg is not even cutting this and other mp4s to the nearest second [duplicate]

I have a file Other - Analogue Clock-JEJqy1Wlovw.mp4 which is just a download from It's 2 minutes 13 seconds long. I had some issues cutting it to the ...
  • 22.5k
114 votes
13 answers

How to create a video from images using FFmpeg?

Is it possible to use ffmpeg create a video from a set of sequences, where the number does not start from zero? For example, I have some images [test_100.jpg, test_101.jpg, test_102.jpg, ..., ...
user avatar
63 votes
7 answers

What is the correct way to fix keyframes in FFmpeg for DASH?

When conditioning a stream for DASH playback, random access points must be at the exact same source stream time in all streams. The usual way to do this is to force a fixed frame rate and fixed GOP ...
62 votes
1 answer

Add audio to video using FFmpeg

I’m trying to add sound to a video using FFmpeg, but for some reason, when I play the resulting file, it doesn't have any sound. I also tried doing it with an aac audio file, as well as leaving out -...
  • 1,468
59 votes
1 answer

Convert AVI (Xvid) to MP4 (H.264) keeping the same quality

I want to compress an AVI file to MP4 using an h.264 codec. I could not get the same quality. How can I compress it? Original Video: Original Video Screen: FFmpeg console output (ffmpeg -i input....
  • 748
51 votes
1 answer

Why can't Quicktime play a movie file encoded by FFmpeg? [duplicate]

When I try to open a movie I just created with the command: ffmpeg -pattern_type glob -i '*.JPG' -s 640x480 movie.mp4 I get an error from QuickTime: The document “movie.mp4” could not be opened. ...
  • 2,514
16 votes
4 answers

Which codecs are most suitable for playback with Windows Media Player on Windows XP?

I need to encode a short video in a format that can be played with windows media player on windows xp without installing any additional codecs. For the recoding process I'm using ffmpeg. I've already ...
  • 5,817
13 votes
1 answer

How do I extract the timestamps associated with frames ffmpeg extracts from a video with the -r option?

ffmpeg -i myvid.mp4 -r 25 -t 100 image-%d.jpeg Is the command I'm using to extract frames and it's working just like I expected. However I'd also like to look at the timestamps of the frames. ...
  • 235
9 votes
1 answer

ffmpeg: smooth zoompan with no jiggle

I'm trying to create a basic 5 second zoompan to the center of an image (from the example on the website). The command below works, but jitters more than my hands after 5 cups of coffee: ...
6 votes
1 answer

What lossy audio formats are more (or less) "efficient"?

This question is related to the answers I got to this question. The bitrate-efficient format (see the question's most voted answers and their comments thereunder) would be one that assures a good ...
user avatar
72 votes
4 answers

How to extract subtitle from video using ffmpeg?

I am trying to extract subtitle from video as .srt file, I used the following command: FFMPEG -i mytestmovie.mkv -vn -an -codec:s:0.1 srt But, I got an error as Unrecognized option codec:s:...
  • 731
71 votes
3 answers

FFMPEG Splitting MP4 with Same Quality

I have one large MP4 file. I am attempting to split it into smaller files. ffmpeg -i largefile.mp4 -sameq -ss 00:00:00 -t 00:50:00 smallfile.mp4 I thought using -sameq would keep the same quality ...
  • 1,205
51 votes
1 answer

Explanation of x264 tune

Running this command: ffmpeg -i xr.mp4 -tune ya zu.mp4 reveals the possible tune values for x264 and in turn FFmpeg: [libx264 @ 0000000002167100] Possible tunes: film animation grain stillimage ...
  • 1
39 votes
3 answers

How to create an uncompressed AVI from a series of 1000's of PNG images using FFMPEG

How can I create an uncompressed AVI from a series of 1000's of PNG images using FFMPEG? I used this command to convert an input.avi file to a series of PNG frames: ffmpeg -y -i input.avi -an -...
user avatar
39 votes
4 answers

How can I pipe output of ffmpeg to ffplay?

How can I pipe the output of ffmpeg to ffplay? At the moment I use a workaround in bash : mkfifo spam (ffplay spam 2> /dev/null &) ; capture /dev/stdout | ffmpeg -i - spam
  • 3,058
38 votes
9 answers

How to install FFmpeg on Debian?

How do I install FFmpeg on Debian?
user avatar
28 votes
1 answer

deprecated pixel format used, make sure you did set range correctly

Why am I getting this warning and how to fix it? Essentially, I want to convert a video to a jpg every 4th frame with the same resolution as original video. [jalal@goku vid2]$ ffmpeg -i debate_vid2....
25 votes
1 answer

What ffmpeg command line produces video more compatible across all devices?

So I have users saying H264 videos MP4's don't play audio on Apple's iPad and I struggle to get MP4 videos to play properly on Android too. There are two different command lines what command line is ...
  • 549
21 votes
4 answers

ERROR: cuvid requested, but not all dependencies are satisfied: cuda/ffnvcodec

I am trying to compile FFMPEG with Nvidia Cuda support, on Debian 9.3. Parameters, what I am using: --enable-cuda --enable-cuvid --enable-nvenc --extra-cflags=-I/usr/local/cuda/include --extra-...
  • 324
21 votes
1 answer

How to replace an audio stream in a video file with multiple audio streams?

I want to replace the second audio stream (0:2) in a video file that has two audio streams and give it a label if possible. How would I go about this? All the ffmpeg commands I found won't let me keep ...
  • 311
12 votes
2 answers

How to compile the best version of FFmpeg for Cygwin/Windows

It's generally accepted that, by default, FFmpeg comes packaged with lower-quality encoders - particularly when it comes to the default AAC encoder and the default resampler. According to these ...
  • 10.9k
8 votes
1 answer

Merge many audio files with specific positions

I have multiple audio files that represent the session. So in one folder I may have: 2016-06-22-15-59-59-000.mka 2016-06-22-16-59-59-001.mka 2016-06-22-17-59-59-002.mka Filename is the date and time ...

2 3 4 5