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
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 ...
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
467 votes
4 answers

Remove audio from video file with FFmpeg

How can I strip the audio track out of a video file with FFmpeg?
  • 4,907
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
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
240 votes
2 answers

How to resize a video to make it smaller with FFmpeg

How do I resize a video to make it smaller with FFmpeg? (e.g. from 1024x576 to 720x480.)
  • 2,501
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
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
206 votes
4 answers

How can I convert MP4 video to MP3 audio with FFmpeg?

I need to extract an MP3 audio track from an MP4 video with ffmpeg. I can do this for .flv -> mp3, but I don't know the command line parameters for mp4->mp3. For example, flv -> mp3: ffmpeg -i video....
user avatar
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?...
151 votes
5 answers

How can I get ffmpeg to convert a .mov to a .gif?

I'm trying to convert a .mov to a .gif and I'm not having success. Here's the error: ffmpeg -pix_fmt rgb24 -i output.gif ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg ...
142 votes
1 answer

ffmpeg - replace audio in video

How to replace the audio in a video file using an audio file using ffmpeg? I imagine the command looks like: ffmpeg -i v.mp4 -i a.wav -MAGIC video-new.mp4 This is very similar to How to replace an ...
  • 7,585
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
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
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
102 votes
8 answers

How to extract one frame of a video every N seconds to an image?

How can I convert a video file to a sequence of images, for example one frame every N seconds. Can mplayer or ffmpeg do this? I have used MPlayer to grab screenshots manually but I would like to ...
  • 2,800
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
97 votes
7 answers

FFMPEG: Convert m4a to mp3 without significant loss

I have a load of audio files (about 1000) which I want to convert from m4a to mp3 so I can use play them on a CD player which has a USB port. I tried doing something simple like: ffmpeg -i FILE.m4a ...
  • 2,107
95 votes
3 answers

Why would I choose Libav over FFmpeg, or is there even a difference?

From what I've seen it looks to me like Libav's avconv is thought to become a successor of ffmpeg — is that correct? If that's true, why is that so? What exactly is libav doing better and why would ...
  • 1,374
95 votes
5 answers

In ffmpeg, how to delay only the audio of a .mp4 video without converting the audio?

In my .mp4 file the audio delay is -3840 ms. I synced it in KMplayer, and I don't want to use MKVGUI to make a .mkv file. I just need to delay the audio by 3840 ms, everything else should be left ...
  • 951
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.
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
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
86 votes
8 answers

Use ffmpeg copy codec to combine *.ts files into a single mp4

I've got a bunch of ts segments described by a single index.m3u8 file: index.m3u8 segment1_0_av.ts segment2_0_av.ts segment3_0_av.ts segment4_0_av.ts segment5_0_av.ts I know they are ...
  • 1,493
86 votes
5 answers

How many threads does ffmpeg use by default?

I see that there's a -threads <count> command line option in ffmpeg. What is the default value of this option?
  • 1,139
84 votes
2 answers

Converting video from 1080p to 720p with smallest quality loss using ffmpeg

I stack with my high quality movie: 1080p with 60fps. The trouble is lags while playing. I tried to convert it to 720p with ffmpeg: ffmpeg -i MyMovie.mkv -r 60 -s hd720 MyMovie_720p.mkv But I ...
  • 1,019
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
74 votes
7 answers

How do I use ffmpeg to get the video resolution?

I am trying to get resolution of the video with the following command: ffmpeg -i filename.mp4 I get a long output, but I need just the width and height for my bash script. How should I filter out ...
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
70 votes
8 answers

Reduce background noise and optimize the speech from an audio clip using ffmpeg

I extract audio clips from a video file for speech recognition. These videos come from mobile/other handmade devices and hence contain a lot of noise. I want to reduce the background noise of the ...
  • 813
70 votes
1 answer

Why does FFmpeg choose 10+20+20 ms instead of an even 16 ms for 60 fps GIF images?

I have a short 60 fps video which I'd like to turn into a GIF file. I run ffmpeg -i foo.flv foo.gif and it produces a GIF file. Great! The only problem is that the motion in the produced GIF video ...
67 votes
7 answers

Concatenate multiple WAV files using single command, without extra file

I want to concatenate multiple WAV files into a single WAV file using FFMPEG. I have used the following command and it generates the required file. Command: ffmpeg -f concat -i mylist.txt -c copy ...
  • 873
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
67 votes
6 answers

FFMPEG convert flv to mp4 without losing quality [duplicate]

Currently I'm converting .flv flash files to .webm and .mp4 files to be used with an HTML5 video player. _ I use this ffmpeg command for WEBM: ffmpeg -i filename.flv -vcodec libvpx -acodec libvorbis ...
67 votes
1 answer

How to specify audio and video bitrate

I have a mov file with the following media information: Stream 0 Type: Video Codec: H264-MPEG-4 AVC (part 10)avc1 Language: English Resolution: 1280x720 Frame rate: 24 Stream 1 Type: Audio Codec: ...
  • 5,355
65 votes
13 answers

Properly downmix 5.1 to stereo using ffmpeg

I have a 5.1 audio track from a film where front left and front right contains music, and center contains dialogue. Playing the 5.1 track in VLC blends everything together nicely. I'm trying to ...
  • 1,777
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
61 votes
2 answers

Install FFmpeg on OS X

Is there a good place or bash script I can use (or at least a version I can build myself) for FFmpeg on OS X? I have Xcode installed as well as the CLI for Xcode (gcc etc). I have a version of ...
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
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
55 votes
1 answer

Downloading m3u8 videos [closed]

I am trying to download video from a .m3u8 livestream video format. How can I download m3u8 videos using software on my personal computer such as ffmpeg, youtube-dl, VLC, etc? M3U is a computer file ...
  • 681
55 votes
3 answers

How to encode audio with Opus codec?

The Opus audio codec looks like the best codec so far for compressing audio. It has recently become supported in the latest ffmpeg and VLC players. However, there is no documentation I can find on how ...
  • 907
55 votes
3 answers

Extracting wav from mp4 while preserving the highest possible quality

I went through the documentation and I can extract a wav file from an mp4 file with the command: ffmpeg -i my_video.mp4 output_audio.wav However, how can I control the quality of the wav file? (e.g. ...
54 votes
2 answers

Why does preset "veryfast" in FFmpeg generate the most compressed file compared to all other presets?

The FFmpeg wiki says that the best compression rate is by preset "veryslow". But when I am trying it with my video then preset veryfast provides the best compression in my case. The following is the ...
  • 651
53 votes
1 answer

Convert specific video and audio track only with ffmpeg

I have an MKV file (vidui.mkv) with 6 tracks in it. Track 1 - video - xvid - 1920x1080 Track 2 - video - xvid - 720x576 Track 3 - audio - AAC - 1240kbps - English Track 4 - audio - AAC - 648kbps - ...
  • 661
52 votes
4 answers

Clarification for ffmpeg input option with image files as input

I have some images and I'd like to make an animated gif with ffmpeg. The images have names as: 837_1.png 838_1.png ... I'm trying to unserstand the -i command line option of ffmpeg but I am crashing ...
  • 749
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
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

2 3 4 5