Using ffmpeg.exe (under Windows) ,  I want to produce a 1280 by 720 pixel video  that combines half-height -cropped versions of  two video sources (input streams)  that are stacked atop one another.  One source is from a webcam, which is set to capture at 1280x720. I want to use the top half of that (top 360 of the 720 lines of vertical). video="Microsoft LifeCam HD-5000"  The other (2nd) source is from video="screen-capture-recorder"  -- I have read many threads online, found via web searches. I am very confused. I could use some hand-holding. I tried the new vstack filter. I don't need pad (padding). I can't find a simple example (command line) that matches what I am looking for.  I added  -vf "crop=1280:360:1280:360"  Maybe the first two values should be different ('0's , maybe ? ) .   I tried placing that portion of the command in different places, relative to the specifications of the input -f dshow -i "video=[...]".  I'm confused by map  (graph) stuff of ffmpeg.  "[0:v][1:v]vstack[v]" -map "[v]"  Once I am able to record video, I also want to combine with audio. Audio will be from a single source.  I have successfully made many videos using just screen/desktop capture + loopback audio using Windows Direct Show -- in which I record from only a single video source ...   e.g. :   ffmpeg.exe -f dshow -framerate 30 -i video="screen-capture-recorder":audio="virtual-audio-capturer" -filter_complex amix=inputs=1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -acodec pcm_s16le (output file)     examples of commands that I have tried, and failed are :   ffmpeg -f dshow -i video="screen-capture-recorder" -f dshow -i video="Microsoft LifeCam HD-5000" -vf "crop=1280:360:1280:360" -filter_complex vstack -vcodec libx264 -pix_fmt yuv420p -preset ultrafast 5000screen_take1.mkv   I even tried adding :  "[0:v][1:v]vstack[v]" -map "[v]" to that , above (previous) command.
34286
I need scale up video from one DOS game using . But with  on left side and  filter on the other one.  Input (320x200)    Output (1280x800)    Here is a command, where's xBR processing whole screen...  ffmpeg     -i input.avi     -sws_flags neighbor     -vcodec libx264 -strict -2     -preset veryslow -qp 0     -filter:v "xbr=4"     output.mp4
30348
Following the guide in  I did:  $ sudo modprobe v4l2loopback $ ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0   The device /dev/video0 shows up as expected but the ffmpeg command fails with following output:  $ ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers ... [x11grab @ 0x559767794cc0] Stream #0: not enough frames to estimate rate; consider increasing probesize .... [v4l2 @ 0x55976779e6c0] ioctl(VIDIOC_G_FMT): Invalid argument Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 --  Conversion failed!   I already tried to follow the suggestions below the answer to no avail. I noticed that v4l2 is listed as demux only in ffmpeg -formats. Does that mean I can't use it for output to /dev/video0? If so, what should I use instead? I tried h264 but that crashes after ~1000 frames with following error message:  $ ffmpeg -f x11grab -r 15 -s 1280x720 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f h264 /dev/video0 ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers ... [x11grab @ 0x55da61e29cc0] Stream #0: not enough frames to estimate rate; consider increasing probesize ... File '/dev/video0' already exists. Overwrite ? [y/N] y .... Error writing trailer of /dev/video0: Invalid argument .... Conversion failed!
93189
I'm using this command to copy the video &amp; audio streams while also encoding the first audio stream to a stereo AAC track as well:  ffmpeg -y -i in.mkv -map 0:v -c:v copy -map 0:a:0? -c:a:0 copy -map 0:a:0? -c:a:1 aac -b:a:0 192k -ac 2 -map 0:a:1? -c:a:2 copy -map 0:a:2? -c:a:3 copy -map 0:a:3? -c:a:4 copy out.mkv   However, I'm also wanting to filter that stereo track with better channel mapping like so:  -af "pan=stereo|FL=FC+0.25*FL+0.60*LFE|FR=FC+0.20*FR+0.60*LFE"   But when I try that I get the following error:  Filtering and streamcopy cannot be used together.   Is there any way around that error? As I'd like to have the original audio stream in tact, while also encoding another version to a 'nightmode' stereo track.
47216
Following  I managed to create high quality gifs in reasonable memory size.  Using piping, what I'm currently doing is this  # Generate palette ffmpeg -y -i - -vf fps=15,scale=600:-1:flags=lanczos,palettegen some_dir/palette.png  # Generate gif using palette ffmpeg -y -i - -i some_dir/palette.png -filter_complex fps=15,scale=600:-1:flags=lanczos[x];[x][1:v]paletteuse output.gif    This is working great, but I read in the tutorial above that it is possible to generate a different palette for EVERY frame, how can I do that ? (Generate and use different palette for every frame)
84477
I would like to scale a watermark to 5% of the video width.  I need something like that:  ffmpeg -i 1.mp4 -i logo.png -filter_complex "[1:v] scale=1_MP4_VIDEO_WIDTH*0.05:-1 [logo1]; [0:v][logo1] overlay=0:0" -y -b 1600k -c:v libx264 -profile high -level 4.1 -c:a libfaac -q:a 128k 2.mp4   How can I reference the video width?
41114
To average two frames in FFmpeg, one can use something like "tblend=all_mode=average,framestep=2". However, this only supports blending two frames at a time. Daisy chaining them only allows you to blend 2^N frames. What if I want to blend 3 frames, 5 frames, 6, 7, 9, and so on?  For my project in particular, I need to average 5 video frames into one. The source footage is 120fps, so this conversion would effectively reduce the framerate to 24. With tblend, this just won't be possible. How else can I go about this?
51677
I'm trying to create a basic 5 second zoompan to the center of an image (from the example on the ). The command below works, but jitters more than my hands after 5 cups of coffee:  ffmpeg -framerate 25 -loop 1 -i island.jpg -filter_complex "[0:v]scale=-2:480,zoompan=z='min(zoom+0.0015,1.5)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d=125,trim=duration=5[v]" -map "[v]" -y out.mp4   .  .  I'm aware of the . The posted suggested workaround is to use the scale filter prior to zoompan. But as shown in my example, this still seems to have no effect.  It seems any arbitrary x or y values cause the jiggle/jerky/shaky effect.  Can anyone offer any kind of effective workaround?  Thanks!  Version info:  ffmpeg version 3.1.2-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 5.4.0 (Debian 5.4.0-6) 20160609
27099
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.mov -r 0.25 images_%08d.jpg ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)   configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect   libavutil      54. 20.100 / 54. 20.100   libavcodec     56. 26.100 / 56. 26.100   libavformat    56. 25.101 / 56. 25.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 11.102 /  5. 11.102   libavresample   2.  1.  0 /  2.  1.  0   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  1.100 /  1.  1.100   libpostproc    53.  3.100 / 53.  3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'debate_vid2.mov':   Metadata:     major_brand     : qt       minor_version   : 0     compatible_brands: qt       creation_time   : 2017-03-10 02:45:46   Duration: 01:36:50.03, start: 0.000000, bitrate: 785 kb/s     Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)     Metadata:       creation_time   : 2017-03-10 02:45:46       handler_name    : Core Media Data Handler     Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 334x360 [SAR 1:1 DAR 167:180], 685 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)     Metadata:       creation_time   : 2017-03-10 02:45:46       handler_name    : Core Media Data Handler       encoder         : H.264 [swscaler @ 0x1bb4240] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'images_%08d.jpg':   Metadata:     major_brand     : qt       minor_version   : 0     compatible_brands: qt       encoder         : Lavf56.25.101     Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 334x360 [SAR 1:1 DAR 167:180], q=2-31, 200 kb/s, 0.25 fps, 0.25 tbn, 0.25 tbc (default)     Metadata:       creation_time   : 2017-03-10 02:45:46       handler_name    : Core Media Data Handler       encoder         : Lavc56.26.100 mjpeg Stream mapping:   Stream #0:1 -&gt; #0:0 (h264 (native) -&gt; mjpeg (native)) Press [q] to stop, [?] for help frame= 1454 fps= 25 q=1.6 Lsize=N/A time=01:36:56.00 bitrate=N/A dup=0 drop=172847     video:28470kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [jalal@goku vid2]$
98978
I have been struggling with .mp4's for about 2 days now, trying to concatenate a series of about 20 into 1 single file. Any differences between the files and it is a nightmare. Some files have different fps, and others different ratios.  I wanted to know if mp4 is the format I should be using, or if there is a better, easy to use format for concatenation. Time isn't an issue, I simply need a relatively high-quality format that concatenates under most circumstances.  If this doesn't exist, any suggestions on how to deal with massively varying properties of mp4 files (I'm not entirely sure of what can differ aside from fps and ratio between videos that may cause a problem) would be great.  I am using ffmpeg to try and concatenate the files. First I tried to use the demuxer, and then the concat filter, however I find the concat filter very daunting and am completely at a loss as to how to use it.  Each video has audio, some have still images while others have moving.
20459
This Super User answer  has got me so far, but now that I have tried many solutions and seen every SO link out there, it's time to ask you all for help.  I am trying to crossfade 2 videos that are 10 seconds each in ts format with audio and video at the same time.   The steps are:   Add complex filter black screen Fade out video 1 after 9 seconds, with 1 second fade duration Fade in video 2 at 9 seconds, with 1 second fade duration Trim black filter output to 19 seconds   This works fine for just video alone, but when I attempt to add audio, I can't get past this error message:     Output pad "default" with type audio of the filter instance "Parsed_asetpts_4" of asetpts not connected to any destination   It appears I'm not connecting the audio output properly. I think I need to alter the [over] lines to include audio. But how do I do this?  `ffmpeg -i vid1.ts -i vid2.ts -f lavfi -i color=black -filter_complex \ "[0:v]format=pix_fmts=yuva420p,\ fade=t=out:st=9:d=1:alpha=1,setpts=PTS-STARTPTS[v0];\ [0:a]\ afade=t=out:st=9:d=1,asetpts=PTS-STARTPTS[a0];\ [1:v]format=pix_fmts=yuva420p,\ fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+9/TB[v1];\ [1:a]\ afade=t=in:st=0:d=1,asetpts=PTS-STARTPTS+9/TB[a1];\ [a0][a1]amix=inputs=2;\  [2:v]scale=720x406,trim=duration=19[over];\ [over][v0]overlay[over1];\ [over1][v1]overlay=format=yuv420[outv]" -vcodec libx264 -y -map [outv] final.ts`
13946
I figured out how I can concatenate multiple audio files with complex filter, but struggling with offsetting audio in result file. Say, I want to add a gap of 1 seconds silence between each concatenate file. Is it possible to do with FFmpeg?
65473
I have two high-quality mp4 files, which are of two parts of the same show.  I want to merge them together into 1 file, and I usually use VirtualDub to merge my files... But it doesn't seem to support mp4.  What alternatives are available (especially ones that don't require re-encoding)?
77165
I need to convert a set of still images (static cameras pointed at a road) to a video.  I have considered video codecs such as Theora, H.264, VP8, VP9, HEVC, Snow.   The video should have a minimum size with the maximum image quality. Now, from all available command-line arguments, I'm using framerate (fps), b:v (bitrate) and s (width*height). Also, for H.264 and HEVC there are -crf and -preset.  What other command-line arguments can be useful to achieve what I'm after? In ffmpeg dozens of command-line arguments and parsing each can take a long time.
109945
Here's my concrete problem:  I am broadcasting a game via XFire and it uses the Windows audio device to capture any audio I receive. As I am broadcasting, other users who watch the video stream are communicating with me over Skype, and they hear themselves back within the video stream and it is entirely logical since I am broadcasting the audio I hear.  What I want to do is create another audio device within Windows and redirect (pipe) ONLY the audio input from that game and not the input reveived from Skype. I would then tell XFire to use that newly created "virtual" audio device to broadcast and therefore my partners won't hear themselves back.  Is it possible to create another audio device and redirect only wanted input streams to it?
36959
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. At whatever precision. 100 miliseconds is good enough for me. Can ffmpeg do this?  Providing additional details,  When I run the above command i get around 100 JPEGs, I guess there is a 1 to 1 (or many to 1) correspondence between these JPEGS and frames of the video. I would like to know the timestamp of the frame that was output as a JPEG image 'i'.   Additionally I tried ffprobe but I find it reports even the video duration inaccurately :(
51254
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.
21602
I need a good video converter application that can convert from/to many video formats. On Windows I found  to be good. I would like its equivalent or something better on Ubuntu.