Searchable Notebook v 2.2

Enter Word, Words or Phrase and Press Enter.



More ffmpeg commands



Article id- 319 | Date: 2017-03-15 21:05:54 | KEYWORDS:

More ffmpeg commands 

This works Fade Sound and video in and Out

Tried and it works fine

ffmpeg -i fadevid-notsound.mp4 -vf 'fade=in:0:240,fade=out:1600:170' -af 'afade=in:st=0:d=10,afade=out:st=55:d=4' -c:v libx264 -crf 22 -preset veryfast fadeInOut4.mp4

Get number of frames in a video

ffmpeg -i fadevid-notsound.mp4 -vcodec copy -f rawvideo -y /dev/null 2>&1 | tr ^M ' ' | awk '/^frame=/ {print $2}'|tail -n 1
returns a number 1770


WORKS FINE

ffmpeg -i edit.mkv -vf "scale='min(1000,iw)':min'(1000,ih)':force_original_aspect_ratio=decrease,pad=1000:1000:100:218:color=blue" edit7.mkv ffmpeg -i edit.mkv -vf "scale='min(1000,iw)':min'(1000,ih)':force_original_aspect_ratio=decrease,pad=1000:1000:100:218:color=blue" edit7.mkv

Some Image Stuff

Batch convert jpeg to png:
mogrify -format png *.jpg

This will convert image to grayscale and remove all black ( #fff ) or white ( #000 ).

convert 0001.png -alpha copy -fx '#fff' 0101result.png
( you can make some fantastic paintbrushes. with this )
convert 0001.png -alpha copy -fx '#000' 0101result000.png
convert test.png -transparent white transparent.png
( removes all the black element of a png - similar to using alpha color in graphics programs )
gm convert -matte -operator Opacity Assign 80% 3.png output3.png Experimental stuff
convert image.jpg -region 70x110+270+140 –swirl 250 -region 70x120+83+129 –swirl -250 -region 170x170+115+350 –swirl 400 –region 90x50+165+195 –implode -1 Output.jpg
convert –size 200x70 xc:darkred -fill white –draw 'roundrectangle 5,5 195,65 5,5' -fill black -pointsize 35 –draw "text 12,45 'i m p l o d e'" -implode 0.5 implode.bmp
ffmpeg -noautorotate -i input.mp4 -vf "transpose=1,scale=-1:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:a copy -metadata:s:v rotate=0 rotated.mp4
ffmpeg -i input -vf "scale='min(1280,iw)':min'(720,ih)':force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2" output

Slow Different spots in the middle of a video

untested
The input in this example has a duration of 60 seconds. 0-10 will be normal speed, 10-30 will be 50% slower, 
and 30-end will be normal speed resulting in an output with a duration of ~80 seconds: ffmpeg -i input.mkv -filter_complex "[0:v]trim=0:10,setpts=PTS-STARTPTS[v1]; [0:v]trim=10:30,setpts=PTS-STARTPTS[v2]; [0:v]trim=start=30,setpts=PTS-STARTPTS[v3]; [v2]setpts=PTS/0.5[slowv]; [v1][slowv][v3]concat=n=3:v=1:a=0[out]" -map [out] output.mp4 ffmpeg -i in.mp4 -vf "select='if(gt(scene,0.01),st(.2,t),lte(t-ld(.2),.2)',setpts=N/FRAME_RATE/TB" trimmed.mp4 ffmpeg -i seamless.mkv -vf "select='if(gt(scene,0.01),st(1,t),lte(t-ld(1),1))',setpts=N/FRAME_RATE/TB" trimmed.mp4 ffmpeg -i seamless.mkv -vf "select='if(gt(scene,0.01),st(.2,t),lte(t-ld(.2),.2))',setpts=N/FRAME_RATE/TB" trimmed.mp4 ffmpeg -i seamless.mkv -vf "select='if(gt(scene,0.01),st(.2,t),lte(t-ld(.2),.2))',setpts=N/FRAME_RATE/TB" trimmed.mp4 http://stackoverflow.com/questions/40966394/how-to-simply-remove-duplicate-frames-from-a-video-using-ffmpeg

Avconv Information and Configuration

avconv
ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'




FFmpeg commands That I use



Article id- 318 | Date: 2017-03-15 20:51:07 | KEYWORDS: ffmpeg,ffmpeg commands,

FFmpeg commands That I use 

FFmpeg Commands That Have Worked for Me



Join Multiple video files
Video to Pictures ( mp4 to Jpeg )
Record Audio
Record Video and Audio from H3100 Cam
Remove Audio
Specify Video Length
Video Info
Video Information ( different format )
Resize You tube to Instagram keeping aspect:
Screen Recorder
Stabilize Video
Convert Video Formats
Screen Capture
Capture with Audio Headset Mic
Cropping Video
Making Animated gifs
Making Video from Images
Adding Subtitles
Adding audio ( music)
Capture mp3 from a Video
Two Videos Side by Side
Overlay Videos
Change Video Speed
Cutting Videos
Overlay Video With an Image
Create a Frame Around a Video
Adjust Contrast and Saturation
Adjust Sharpness
Display Video with a Histogram Overlay
Remove Duplicate Frames
Set the Sar in a video( Force Aspect )
Put ripples in a video
Using padding ( black bars ) in a Video
Lighten a video using "curves"
Using Melt to make a fading slide show
Avconv Configuration
Some Image Stuff
If ports are required
If not listed look here


Create a Video with a Histogram Overlay

ffmpeg -i outw.mp4 -vf "split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay" histout.mp4


Joining Files


Mp4 files may not be concated directly because the contain headers.



ffmpeg -i output.mp4 -i image1.png -i image2.png -filter_complex '[0:v][1:v][2:v]overlay[out]' -map '[out]' test2out.mp4
-re -rtbufsize 200M
used:
ffmpeg -i Komiku1.mp3 -filter_complex avectorscope=s=640x640 -y -acodec copy -t 59 videoavector.mp4
used:
ffmpeg -i Komiku9.mp3 -filter_complex showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt -y -acodec copy -t 59 spectrumvideo.mp4
used:
ffmpeg -i videoavector.mp4 -i scope.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,59)'" -pix_fmt yuv420p -c:a copy vectordone.mp4
?
ffmpeg -i input.mp4 -filter_complex "[0:a]showcqt,format=yuv420p[v]" -map "[v]" -map 0:a output.mp4
ffmpeg -i Komiku5.mp3 -filter_complex "[0:a]aphasemeter=s=640x640:mpc=cyan,format=yuv420p[v]" -map "[v]" -map 0:a aphasemeterout.mp4

ffmpeg -ss 76 -i DSCF3876.mp4 -t 20 resource001.mkv
ffmpeg -framerate 10 -i new%06d.bmp -c:v libx264 -r 17 -pix_fmt yuv420p out.mp4
ffmpeg -framerate 17 -i new%06d.bmp -c:v libx264 -r 17 -vf unsharp=3:3:-.5:3:3:-.1 -pix_fmt yuv420p outw.mp4

ffplay outw.mp4 -vf "split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay"

ffmpeg -i outw.mp4 -vf "split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay" histout.mp4

ffmpeg -dumpgraph 1 -f lavfi "color=s=100x100:c=red  [l];color=s=100x100:c=blue [r];nullsrc=s=200x100, zmq [bg];[bg][l] overlay [bg+l]; [bg+l][r] overlay=x=100" test001.mp4

Getting Video Information

 ffprobe output.mp4

ffmpeg -i output.mp4 -i image1.png -i image2.png -filter_complex '[0:v][1:v][2:v]overlay[out]' -map

ffmpeg -i output.mp4 -i image1.png -i image2.png -filter_complex '[0:v][1:v][2:v]overlay[out]' -map '[out]' test2out.mp4

Lighten a video

ffmpeg -i outputlighter.mp4 -vf curves=preset=lighter -c:a copy outputlighter2.mp4
The red, green, and blue colors may be adjusted separately. curves=r='0.4/0.5':g='0.4/0.5':b='0.4/0.5' More info - Visit Curves on ffmpeg

ffmpeg -f concat -i mylist.txt -c copy video_draft.avi
ls *.avi | while read each; do echo "file '$each'" >> mylist.txt; done

If in the same directory:
file '001.flv'
file '002.flv'
file '003.flv'
file '004.flv'
file '005.flv'
file '006.flv'
file '007.flv'

file '/path/here/file1.avi'
file '/path/here/file2.avi'
file '/path/here/file3.avi'


MP4 to Jpeg ( pictures)

I have used this on Mp4 video works fine


ffmpeg -i input.mp4 -qscale:v 2 output_%03d.jpg

Remove Black Background

Still experimenting : this worked but removes ALL black

ffmpeg -i planetshort.mp4 -i meshort.mp4 -filter_complex "[1]split[m][a]; [a]geq='if(gt(lum(X,Y),16),255,0)',hue=s=0[al]; [m][al]alphamerge[ovr]; [0][ovr]overlay" -t 59 -strict -2 output000.mp4

Ripple A video


tested
ffmpeg -i out.mp4 -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' ripple.mp4

For Instagram 700x700 Ripple

ffmpeg -i voko.mp4 -f lavfi -i nullsrc=s=700x700,lutrgb=128:128:128 -f lavfi -i nullsrc=s=700x700,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' ripple2.mp4
Also tested

Mogrify - Change all image sizes in a folder.

>

This command replaces the original image with a new size.

mogrify -resize 1080x1080 *.png

Record Sound only *.wav or *.mp3

100,DEV=0 -acodec libmp3lame -t 20 output.wav
the -t 20 sets the recording time to 20 seconds
ffmpeg -f alsa -i plughw:CARD=H3100,DEV=0 -acodec libmp3lame -t 20 output.MP3

BOTH worked fine for me.
ffmpeg -f alsa -i plughw:CARD=H3


Record video and sound This is from a HP3100 USB camera and microphone.

This works pretty good I think. I did not check the sync :
ffmpeg -f alsa -i pulse -f x11grab -r 17 -s 1360x760 -i :0.0 -acodec pcm_s16le catchit.mkv
ffmpeg -thread_queue_size 512 -f alsa -i pulse -f x11grab -r 17 -s 1280x720 -i :0.0 -acodec pcm_s16le 0001.mkv
ffmpeg -thread_queue_size 768 -f alsa -i pulse -f x11grab -r 17 -s 1280x720 -i :0.0 -acodec pcm_s16le 0001.mkv

Specify a video length


ffmpeg -ss 0 -i 50head.mp4 -t 59 -c copy 50head0ut.mp4

remove the audio

Proven it works:
ffmpeg -i example.mkv -c copy -an example-nosound.mkv
Don't re-encode the video (which is a slow and lossy process), so try:
ffmpeg -i [input_file] -vcodec copy -an [output_file]

Capture Video sound as MP3

ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 sound.mp3

Getting video Information

Example FFprobe

ffprobe Sleeping.mp4
ffprobe version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Sleeping.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2013-05-22 06:03:40
  Duration: 00:05:12.73, start: 0.000000, bitrate: 494 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 396 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2013-05-22 06:03:50
      handler_name    : IsoMedia File Produced by Google, 5-11-2011

Resize Youtube to Instagram keeping aspect:


BEST:
ffmpeg -i Sleeping.mp4 -vf scale=640:-1 -an -strict -2 testout.mp4


experimental stuff:


resize
ffmpeg -i in.mp4 -filter:v "scale=iw*min($width/iw,$height/ih):ih*min($width/iw,$height/ih), pad=$width:$height:($width-iw*min($width/iw,$height/ih))/2:($height-ih*min($width/iw,$height/ih))/2" out.mp4
use video and square it no black lines
ffmpeg -i Sleeping.mp4 -s 640x640 -t 00:05:13 -q:v 10 -ac 1 -c:v libx264 -strict -2 output6.mp4
-vf scale=720:432,pad=720:576:0:72
ffmpeg -i in.mp4 -vf scale=640:640,pad=480:360:0:80 -strict -2 testout.mp4

I WILL USE THIS SREEN RECORDER

 - NO ERRORS GREAT RECORDING - Works well with Gimp and Blender ;
works with HP3100 microphone or with headsets:
ffmpeg -thread_queue_size 768 -f alsa -i pulse -f x11grab -r 17 -s 1360x760 -i :0.0 -preset ultrafast -acodec pcm_s16le 0003.mkv 
experimental:
ffmpeg -f alsa -r 16000 -i hw:2,0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -qscale 0 -acodec libmp3lame -ab 96k output.avi
ffmpeg -f alsa -r 16000 -i plughw:CARD=H3100,DEV=0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -qscale 0 -acodec libmp3lame -ab 96k output.mp4
ffmpeg -f alsa -i plughw:CARD=H3100,DEV=0 -acodec libmp3lame -ab 96k -s hd720 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast desktop.mkv

Ffmpeg may be used with no options

The i- following ffmpeg proceeds the file name. The simple command below uses same size and the frame rate defaults to 25 ( -framerate 25 ).


ffmpeg -i infile.avi youroutput.mp4
If you wish to keep the frame sizes and frame rate intact use the -strict option. it results in a high quality video if possible.
ffmpeg -i input.avi -strict -2 output.mp4
ffmpeg -i input.mkv -codec copy output.mp4

Good Screen Capture - NO errors


Beautiful lossless screen capture (NO AUDIO) works with ffmpeg version ffmpeg version N-83393-g39afd04 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.2.1 (Ubuntu 5.2.1-23ubuntu1~15.10) 20151028:
Used Feb7th 2017

This may or may not be used with -t option to limit video length. It also shows time lapsed and allows " q " to stop screen recording


ffmpeg -f x11grab -r 17 -s 1360x760 -i :0.0 -vcodec libx264 -preset ultrafast -t 20 test001.mp4

???
NOT GOOD 
a. ffmpeg -f x11grab -framerate 30 -video_size 1360x760  -i :0.0 -c:v libx264 -qp 0 -preset ultrafast capture.mkv ( Large File ) 
b. Then run this to lossless reduce the size. 
c. ffmpeg -i capture.mkv -c:v libx264 -qp 0 -preset veryslow capture_smaller.mkv   ( lossless smaller ) 
d. ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+0,0 -f alsa -ac 2 -i pulse -acodec aac -strict experimental soundoutput.flv 


Some Graphic Toys

ffmpeg -i drum.mp3 -filter_complex "[0:a]ahistogram,format=yuv420p[v]" -map "[v]" -map 0:a -t 59 ahistogram.mp4
ffmpeg -i drum.mp3 -filter_complex "[0:a]showfreqs=mode=line:fscale=log,format=yuv420p[v]" -map "[v]" -map 0:a -t 59  showfreqs-line.mp4
fmpeg -i drum.mp3 -filter_complex "[0:a]showfreqs=mode=bar:fscale=log,format=yuv420p[v]" -map "[v]" -map 0:a -t 59 showfreqs-bar.mp4
( https://ffmpeg.org/ffmpeg-filters.html#showfreqs )
ffmpeg -i dream.mp3 -filter_complex "[0:a]showspectrum=s=1280x720,format=yuv420p[v]" -map "[v]" -map 0:a -t 59 showspectrum.mp4
ffmpeg -i dream.mp3 -filter_complex "[0:a]showwaves=s=1280x720:mode=line:rate=25,format=yuv420p[v]" -map "[v]" -t 59 showwaves.mp4

ffmpeg -i input.mp4 -vf "hflip,vflip,format=yuv420p" -metadata:s:v rotate=0 -codec:v libx264 -codec:a copy output.mkv

Screen Capture using ffmpeg

works with headset:
shows warnings but works fine
ffmpeg -framerate 25 -video_size 1360x760 -f x11grab -i :0.0 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.mkv
works with warnings:
shows even more warnings but works fine
ffmpeg -framerate 17 -s hd720 -f x11grab -i :0.0 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le motest.mkv

works with my hp3100 WebCam

ffmpeg -thread_queue_size 512 -f alsa -ac 1 -ar 48000 -i plughw:CARD=H3100,DEV=0 -s 1366x768 -f x11grab -i :0 -r 30 -vcodec libx264 testit.mkv

the HP3100 Webcam option

-i plughw:CARD=H3100,DEV=0
GOOD ( no audio ) !!
Lossless recording
ffmpeg -video_size 1360x750 -framerate 17 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast desktop2.mkv
-qp 0 tells x264 to encode in lossless mode and the -preset ultrafast instructs 'do it fast' fast.
This captured the camera ...
ffmpeg -i /dev/video0 -c:v libx264 -preset fast /home/jack/Desktop/CAM001.mp4 ffmpeg -f x11grab -s hd720 -r 25 -i :0.0+10,20 hd720.mp4

Adjust Contrast

contrast may range from -2 to plus 2.
It may be run on the output file to REALLY increase the contrast.  
ffmpeg -i postsized.mp4 -filter_complex "eq=contrast=2:brightness=0:saturation=1:gamma=1:gamma_r=1:gamma_g=1:gamma_b=1:gamma_weight=1" contrast.mp4
Set brightness, contrast, saturation and approximate gamma adjustment.
The filter options:
contrast float value in range -2.0 to 2.0. The default value is "1".
brightness
Set the brightness expression. The value must be a float value in range -1.0 to 1.0. The default value is "0".
saturation float in range 0.0 to 3.0. The default value is "1".
gamma float in range 0.1 to 10.0. The default value is "1".
gamma_weight float in range 0.0 to 1.0. A value of 0.0 turns the gamma correction all the way down while 1.0 leaves it at its full strength. Default is "1".reduce the effect of a high gamma value on bright image areas it will prevent them from getting overamplified and just plain white. 

Stabilize a video:


ffmpeg -i input.mov -vf deshake output.mov


Frame a Video

ffmpeg -i post612.mp4 -i frame.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,29)'" -pix_fmt yuv420p -c:a copy out.mp4

Cropping a video - I have used this

ffmpeg -i FinalFish.mp4 -filter:v "crop=1024:1141:0:465" Fishout2.mp4

Then I used:
ffmpeg -i Fishout2.mp4 -vf scale=1024:1024 1024.mp4
I used that to "square up" the video for instagram.

To make animated gifs with Image Magic

convert -delay 20 -loop *.png test.gif sudo docker build -t=docker-webpage .

Videos from images

This one works best:
ffmpeg -framerate 1 -i paper%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

ffmpeg -r 60 -f image2 -s 1000x1000 -i %04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p testspace.mp4
ffmpeg -r 17 -f image2 -s 1000x1000 -i %04d.png -vcodec libx264 -crf 17 -pix_fmt yuv420p testspace2.mp4
The encoder should be fast enough on most modern hardware to record without any framedrop, and even leave enough CPU headroom for other applications. If you're going to archive the recording or are concerned about file size, re-encode it losslessly again but with a slower preset. Note that since the initial recording was lossless, and the re-encode is lossless too, no quality loss is introduced in this process in any way.
ffmpeg -i desktop.mkv -c:v libx264 -qp 0 -preset veryslow smaller_size_desktop.mkv
See Encode/H.264 for more info and examples.
Linux:
Use the x11grab device:
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4
This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) with the width and height of 1024x768.
If you need audio too you can use ALSA (see Capture/ALSA for more info):
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 output.mkv
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0 -f alsa -ac 2 -i hw:0 output.mkv
Or the pulse input device:
ffmpeg -video_size 1360x768 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default output.mkv
( captures screen NO AUDIOI)

Adding Subtitles

The last one used - The video was good to upload to Instagram with Subtitles 650x650
it actually embeds the subtitle in the video and survives the instagram transition. I have
tried other which work locally, but the subtitles fail upon upload
ffmpeg -i 650.mp4 -vf subtitles=images.srt srtout.mp4
ffmpeg -i infile.mp4 -f srt -i infile.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
Subtitle Example: first line must be used

--------Start.srt
1
00:00:00,000 --> 00:00:03,000
A touch of Humor

2
00:00:03,050 --> 00:00:05,550
Measured my eye for sleeping mask

3
00:00:05,700 --> 00:00:07,900
layers of glued manila papercan be shaped

4
00:00:11,350 --> 00:00:15,650
cut and shape to eye size

5
00:00:18,000 --> 00:00:20,200
Instant Sleeping Mask

6
00:00:25,00 --> 00:00:29,000
I hope this brought a smile
-- end srt file

Two Videos Side by Side

ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4

This essentially doubles the size of input1.mp4 by padding the right side with black the same size as the original video, and then places input2.mp4 over the top of that black area with the overlay filter.



Adding Music


I have used this it works fine on my linux Box


ffmpeg -i outputcrack3.mp4 -i bomb.mp3 -c copy -map 0:0 -map 1:0 -shortest vid4sound.mp4

Ubuntu Linux - Video on Video - FFmpeg

one extremely lone command line

ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=640x480 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=640x480 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=640x480 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=640 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=480 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=640:y=480" -s 1000x1000 -framerate 17 -c:v libx264 space.mkv
space.mkv

WORKS good location everything

 ffmpeg -i starout.mp4 -i Dance.mp4 -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000  [upperleft];  [1:v] setpts=PTS-STARTPTS, scale=250x250 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][lowerright] overlay=shortest=1:x=700:y=700" -s 1000x1000 -framerate 17 -c:v libx264 vidonvid.mp4
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=410x307 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=410x307 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=410 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=410 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=410:y=307" -s 1000x1000 -framerate 17 -c:v libx264 space2.mkv
space2_0.mkv

ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=500x375 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=0:x=500:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space3_0.mkv
space3_0.mkv

ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=500:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space4_0.mkv
space4_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space5_0.mkv
space5_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=620" -s 1000x1000 -framerate 17 -c:v libx264 space6_0.mkv
space6_0.mkv
first set 640:640 is the video size when completed. The second set 0:0 are where you want to load the original video.
Example below original video is 640x480:
ffmpeg -i contrastg.mp4 -vf pad=640:640:0:0:violet pad.mp4 (puts the padding on bottom)
ffmpeg -i contrastg.mp4 -vf pad=640:640:480:160:violet pad.mp4 (puts the padding on bottom)

Speedup Videos

Speed up a video 11.14 min into 58 sec
ffmpeg -i acorn001.mp4 -r 16 -filter:v "setpts=0.07*PTS" slowoutput2.mp4
1/2 length - ffmpeg -i acorn001.mp4 -r 16 -filter:v "setpts=0.5*PTS" slowoutput2.mp4
ffmpeg -i cut.mp4 -r 16 -filter:v "setpts=0.23*PTS" fastcut.mp4

Cutting a video

This cuts the first 59 seconds from a 5:12 video ffmpeg -i testoutna.mp4 -ss 00:00:59 -t 00:05:12 -async 1 cut.mp4 ffmpeg -i Sleeping.mp4 -r 16 -filter:v "setpts=0.23*PTS" -ss 00:00:59 -t 00:05:12 -async 1 -vf scale=640:-1 -an -strict -2 allinone.mp4 ffmpeg -i vidonvidlong.mpg -vf subtitles=space.srt xxxxx.mp4 ffmpeg -i vidonvid3.mpg -vf subtitles=space.srt instaxxx.mp4
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=693" -s 1000x1000 -framerate 17 -c:v libx264 space7_0.mkv
space7_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=569:y=673" -s 1000x1000 -framerate 17 -c:v libx264 space8_0.mkv

Notice changing -- overlay=shortest=1:x=569:y=673" gave a 20 pixal border on the bottom and right side to the third video.

To View the video information on a video called 'SpaceSubtitle_ffmpeg.mp4':

ffprobe -v error -show_format -show_streams SpaceSubtitle_ffmpeg.mp4

Another File information command

The command below command is no designed to be a file information command, however it works as one. As you see it provides some erroneous information and concludes with an error "At least one output file must be specified". Ffprobe is the desired means of acquiring information.


EXPERIMENT
To show streaming video in a port.
ffmpeg -i /dev/video0 -listen 1 -f matroska -c:v libx264 -preset fast -tune zerolatency http://:8080 ffplay http://localhost:8080/

See the scale and unsharp filters in ffmpeg:


ffmpeg -i input -filter:v "scale=1280:-1,unsharp=5:5:1.0:5:5:0.0" output
The -1 in the scale filter tells ffmpeg to automatically choose the correct height to preserve aspect ratio. You can change the scaler with the -sws_flags option, such as -sws_flags lanczos. For upsampling lanczos is worth trying. Default is bicubic. See the full list at ffmpeg -h full.
ffmpeg -i infile.avi youroutput.mp4 ffmpeg lists each frame as it converts it. I am showing only the last 100 frames. frame= 5410 fps= 15 q=29.0 size= 57761kB time=00:03:00.95 bitrate=2614.9kbits/ frame= 5419 fps= 15 q=29.0 size= 57837kB time=00:03:00.95 bitrate=2618.4kbits/ frame= 5428 fps= 15 q=29.0 size= 57912kB time=00:03:00.95 bitrate=2621.8kbits/ frame= 5436 fps= 15 q=29.0 size= 57983kB time=00:03:01.95 bitrate=2610.6kbits/ frame= 5445 fps= 15 q=29.0 size= 58047kB time=00:03:01.95 bitrate=2613.5kbits/ frame= 5453 fps= 15 q=29.0 size= 58147kB time=00:03:01.95 bitrate=2617.9kbits/ frame= 5459 fps= 15 q=29.0 size= 58242kB time=00:03:01.95 bitrate=2622.2kbits/ frame= 5467 fps= 15 q=29.0 size= 58342kB time=00:03:02.95 bitrate=2612.4kbits/ frame= 5476 fps= 15 q=29.0 size= 58423kB time=00:03:02.95 bitrate=2616.0kbits/ frame= 5485 fps= 15 q=29.0 size= 58497kB time=00:03:02.95 bitrate=2619.4kbits/ frame= 5493 fps= 15 q=29.0 size= 58565kB time=00:03:03.94 bitrate=2608.1kbits/ frame= 5501 fps= 15 q=29.0 size= 58637kB time=00:03:03.94 bitrate=2611.3kbits/ frame= 5509 fps= 15 q=29.0 size= 58706kB time=00:03:03.94 bitrate=2614.4kbits/ frame= 5515 fps= 15 q=29.0 size= 58766kB time=00:03:03.94 bitrate=2617.1kbits/ frame= 5520 fps= 15 q=-1.0 Lsize= 59421kB time=00:03:04.01 bitrate=2645.3kbits /s speed=0.492x video:56347kB audio:2878kB subtitle:0kB other streams:0kB global headers:0kB mux ing overhead: 0.331550% [libx264 @ 00000000005397c0] frame I:23 Avg QP:21.33 size: 66958 [libx264 @ 00000000005397c0] frame P:1390 Avg QP:24.19 size: 22546 [libx264 @ 00000000005397c0] frame B:4107 Avg QP:27.28 size: 6043 [libx264 @ 00000000005397c0] consecutive B-frames: 0.7% 0.2% 0.3% 98.8% [libx264 @ 00000000005397c0] mb I I16..4: 6.2% 91.2% 2.6% [libx264 @ 00000000005397c0] mb P I16..4: 2.9% 12.3% 0.3% P16..4: 57.7% 14.0 % 8.1% 0.0% 0.0% skip: 4.7% [libx264 @ 00000000005397c0] mb B I16..4: 0.3% 1.5% 0.0% B16..8: 33.6% 3.9 % 0.7% direct: 4.5% skip:55.3% L0:48.2% L1:45.6% BI: 6.2% [libx264 @ 00000000005397c0] 8x8 transform intra:80.5% inter:85.6% [libx264 @ 00000000005397c0] coded y,uvDC,uvAC intra: 65.8% 92.4% 23.0% inter: 1 4.7% 37.0% 1.2% [libx264 @ 00000000005397c0] i16 v,h,dc,p: 12% 15% 4% 69% [libx264 @ 00000000005397c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 18% 23% 4% 7% 8% 7% 6% 7% [libx264 @ 00000000005397c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 13% 5% 12% 10% 9% 5% 4% [libx264 @ 00000000005397c0] i8c dc,h,v,p: 49% 14% 27% 9% [libx264 @ 00000000005397c0] Weighted P-Frames: Y:3.0% UV:1.4% [libx264 @ 00000000005397c0] ref P L0: 35.0% 13.2% 34.3% 17.3% 0.2% [libx264 @ 00000000005397c0] ref B L0: 84.1% 10.5% 5.4% [libx264 @ 00000000005397c0] ref B L1: 95.7% 4.3% [libx264 @ 00000000005397c0] kb/s:2508.66 [aac @ 00000000005b9f80] Qavg: 943.549

Set the sar in a video


ffmpeg -i edit7.mp4 -vf scale=1280x720,setsar=1:1 sar11.mp4

Force Square Aspect

ffmpeg -i drumoutput.mp4 -vf scale=660x660,setsar=1:1 drumsquare.mp4

Remove Duplicate Frames



ffmpeg -i voko.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB vokoclean.mp4

Removes Similar Frames

does something different ffmpeg -i in.mp4 -vf mpdecimate out.mp4

Overlay Video with an Image


ffmpeg -i sharpenstress.mp4 -framerate 30000/1001 -loop 1 -i stress.png -filter_complex "[1:v] fade=out:30:d=1 alpha=1 [ov]; [0:v][ov] overlay=10:10 [v]" -map "[v]" -map 0:a -c:v libxx264 -c:a copy -shortest textover.mp4"
ffmpeg -i sharpenstress.mp4 -framerate 30000/1001 -loop 1 -i stress.png -filter_complex "[1:v] fade=out:st=30:d=1:alpha=1 [ov]; [0:v][ov] overlay=10:10 [v]" -map "[v]" -c:v libx264 -c:a copy -shortest stressover.mp4

ffmpeg -i post612.mp4 -i frame.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,29)'" -pix_fmt yuv420p -c:a copy output00.mp4
Adding a title image
ffmpeg -i srtout.mp4 -i intro.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy output2.mp4
ffmpeg -i jazz.mkv -r 16 -filter:v "setpts=0.4*PTS" -strict -2 jazz.mp4 ffmpeg -i jazz.mp4 -i mysound.mp3 -c copy -map 0:0 -map 1:0 jazzsound.mp4 ffmpeg -i jazzsound.mp4 -i experiment.jpg -filter_complex "[0:v][1:v] overlay=10:10:enable='between(t,0,2)'" -pix_fmt yuv420p -c:a copy jaztitle.mp4 ffmpeg -i touchtitle4.mp4 -i touch.jpg -filter_complex "[0:v][1:v] overlay=10:10:enable='between(t,0,2)'" -pix_fmt yuv420p -c:a copy touchjaztitle.mp4
ffmpeg -i touch8.mp4 -i touch.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,3)'" -pix_fmt yuv420p -c:a copy touchoutput00.mp4
USED THIS

This overlaid and centered a 612x612 image on a 1080x1080 video


 ffmpeg -i
uploadfaster2.mp4 -i beams.png -filter_complex "[0:v][1:v] overlay=234:234:enable='between(t,0,3)'" -pix_fmt yuv420p
-c:a copy titlenosound.mp4 

Full steps to making a slide show:

br /> Name all files JPG:
Make sure all images are the same format and size.
mogrify -resize 612x612 *.jpg
turn them all into png: mogrify -format png *.jpg
Make slideshow:
ffmpeg -framerate 1 -i %03d.png -c:v libx264 -r 30 -pix_fmt yuv420p vide12.mp4
Add Music:
ffmpeg -i vide12.mp4 -i 150413_Spanish_Fire---free_download.mp3 -c copy -map 0:0 -map 1:0 -shortest vid12sound.mp4
 Experimental stuff:

Composition Size: maximum width 1080 pixels (height anything, although within the same ratios as images) Frame Rate
29.96 frames per second (max 30fps, but should be fixed, not variable) H.264 codec / MP4 5,500 kbps video bitrate
(although Instagram may reduce this to 3,500kbps when we post it) AAC audio codec at 44.1 kHz mono (up to 128kbps)
 ffmpeg -loop 1 -i ./frames/0253.png -r 30 -t 3 -pix_fmt rgba -vcodec png frame.mov >> log.txt


ffmpeg -i 1350x1350barsOutput.mp4 -i mask.mp4 -filter_complex "[1:0]setdar=dar=1,format=rgba[a];
[0:0]setdar=dar=1,format=rgba[b]; [b][a]blend=all_mode='overlay':all_opacity=0.8" blended.mp4
ffmpeg -i background.m2v -vf "movie=a.m2v [a]; movie=b.m2v [b]; [in][a] overlay=0:366, [b] overlay=592:41" combined.m2v
ffmpeg -i 1.mkv -i 2.mkv -f lavfi -i color=black -filter_complex
"[0:v]format=pix_fmts=yuva420p,fade=t=out:st=4:d=1:alpha=1,setpts=PTS-
STARTPTS[va0];[1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+4/TB[va1];[2:v]scale=612x612,
trim=duration=9[over];[over][va0]overlay[over1];[over1][va1]overlay=format=yuv420[outv]" -c:v libx264  -map [outv]
out.mp4
ffmpeg -i colorparameterstitle.mp4 -i komikucolor.mp3 -c copy -map 0:0 -map 1:0 -shortest colortitlesound.mp4
This creats a black frame and overlays a video on it : Tried and working
ffmpeg -f lavfi -i color=c=black:s=1280x720 -i me.mkv -shortest -filter_complex
"[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output001.mkv
 It makes the black
Transparent works with video also. 
ffmpeg -i jazz.mkv  -i me.mkv -shortest -filter_complex
"[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output002.mkv
resize:
 ffmpeg -i maskme.mp4 -vf scale=350:350 -an -strict -2 maskme350.mkv
ffmpeg -y -i output003.mkv -f lavfi -i color=c=black:s=606x606 -filter_complex "[0:v]scale=w=0.80*iw:h=0.80*ih[scaled];
[1:v][scaled]overlay=x=0.10*main_w:y=0.10*main_h:eof_action=endall[out]; [0:a]anull[aud]" -map "[out]" -map "[aud]"
-strict -2 outputblkbak.mkv
will create a mask behind a video ffmpeg -f lavfi -i color=c=black:s=612x612 -i maskme350.mkv -shortest -filter_complex
"[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" outputmask.mkv
This works fine the masked (in black) video outputmask.mkv --- the regular video jazz.mkv. the black is transparent.

 ffmpeg -i outputmask.mkv  -i jazz.mkv -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" -t 20 output006.mkv
One overlay:
 ffmpeg.exe -i master_video.mp4 -vf "movie=smaller_inner_video.mp4[inner];  [in][inner] overlay=70:70
[out]" completed.mp4
Two Overlays:  
ffmpeg.exe -i master_video.mp4 -vf "movie=smaller_inner_video.mp4[inner];
movie=smaller_inner_video2.mp4[inner2]; [in][inner] overlay=70:70 [step1];  [step1][inner2] overlay=1050:560 [out]"
completed.mp4

Works Great to fade pictures in and out for slideshow

melt -verbose -profile atsc_720p_25 0001.png out=50 0002.png out=75 -mix 25 -mixer luma 0003.png out=75 -mix 25 -mixer luma 0004.png out=75 -mix 25 -mixer luma 0005.png out=75 -mix 25 -mixer luma -consumer avformat:output.mp4 vcodec=libx264 an=1
profile your inputs files. list profiles  -       melt -query profiles 
 melt -query "profile=atsc_720p_25".

This example is using a profile that sets a frame rate of 25, so 25 frames equals 1 second.

mix sets the duration of the fade. The value is in frames.
mixer sets the type of mix.

fade and blend two videos


First video fades to alpha in the 4th second (st=4) during 1 second (d=1), fade in the second one at 0 second (st=0) during 1 second (d=1) and moves it's display time forward to 4 sec (+4/TB). Then we just cut 9 second of black color, scale it to output video size and overlay the stuff.

ffmpeg -i output.mp4 -i output2.mp4 -f lavfi -i color=black -filter_complex "[0:v]format=pix_fmts=yuva420p,fade=t=out:st=4:d=1:alpha=1,setpts=PTS-STARTPTS[va0]; [1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+4/TB[va1]; [2:v]scale=1280x720,trim=duration=9[over]; [over][va0]overlay[over1]; [over1][va1]overlay=format=yuv420[outv]" -vcodec libx264 -map [outv] out.mp4

to Maintain aspect of if a square video is placed in a 1280x720 container


ffmpeg -i output.mp4 -i output2.mp4 -f lavfi -i color=black -filter_complex "[0:v]format=pix_fmts=yuva420p,fade=t=out:st=4:d=1:alpha=1,setpts=PTS-STARTPTS[va0]; [1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+4/TB[va1]; [2:v]scale=1280:-1,trim=duration=9[over]; [over][va0]overlay[over1]; [over1][va1]overlay=format=yuv420[outv]" -vcodec libx264 -map [outv] out.mp4
ffmpeg -i voko1.mp4 -i fade.png -filter_complex " [0:v][1:v] overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1, fade=t=out:st=10:d=1 '" -c:v libx264 -crf 23 -t 59 fadeout.mp4 With "overlay[...],fade[...],fade[...]", you're appying the fading to the whole video and not just the overlay. It's a filter chain, you see, and the fade filters are chained behind the overlay. You will want to do something like adding "-loop 1" before the overlay image, and then using a filter like this: ffmpeg -i voko1.mp4 -i fade.png -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0" -c:v libx264 -crf 23 -t 59 fadeoutput.mp4

This works Fade Sound and video in and Out

Tried and it works fine

ffmpeg -i fadevid-notsound.mp4 -vf 'fade=in:0:240,fade=out:1600:170' -af 'afade=in:st=0:d=10,afade=out:st=55:d=4' -c:v l


Configuring ffmpeg to give it superpowers



Article id- 312 | Date: 2017-03-15 19:38:56 | KEYWORDS: Configuring ffmpeg,configure,ffmpeg

Configuring ffmpeg to give it superpowers 

First and foremost is the configuration of ffmpeg at time of installation. The configuration will determine what filters are available.

My configuration is :
ffmpeg version N-83393-g39afd04 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-23ubuntu1~15.10) 20151028
  configuration: --enable-gpl --enable-libx264 --enable-libmp3lame --enable-nonfree --enable-libfdk-aac --extra-libs=-ldl --enable-libass


old config:
--prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265

want to change to:

./configure --enable-gpl --enable-libx264 --enable-libmp3lame --enable-nonfree --enable-libfdk-aac --extra-libs=-ldl 
--enable-libvidstab --enable-opencl --enable-muxer=mpeg --enable-libfaac --enable-postproc --enable-version3 
--enable-libfreetype --enable-filter=drawtext --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis 
--enable-version3 --enable-x11grab
/



Entering a Docker Container



Article id- 310 | Date: 2017-03-15 19:33:21 | KEYWORDS: Entering a Docker, Container,Entering, Docker, Container,

Entering a Docker Container 
The docker container number can be displayed by:

docker ps

docker exec -it 380753ae8fe5 bash

A container can only be entered if the image is active.





Pulling a Docker Container



Article id- 309 | Date: 2017-03-15 19:27:49 | KEYWORDS: Pulling,Docker, Container,Pulling Docker,pulling container,pulling a container

Pulling a Docker Container 
docker pull container/name


 docker run -it -v /path/to/.m2:/root/.m2 ubuntu:latest /bin/bash 
 
will run the ubuntu:latest image with the host directory /path/to/.m2 'symlinked' to the container directory /root/.m2.



docker run -it -v /home/jack/machine:/root docker-machine /bin/bash

sudo docker cp a532acddf9f2://go/src/github.com/docker/machine /home/jack/machine
 



Using a Dockerfile



Article id- 308 | Date: 2017-03-15 19:23:01 | KEYWORDS: dockerfile, Dockerfile

Using a Dockerfile Using a Dockerfile From the same directory as the Dockfile exists, run:
docker build -t jack_linux .       < the period at the end is important
the " jack_linux " will be the name of the container generated.



Ubuntu locate all of an extension and copy to a directory



Article id- 307 | Date: 2017-03-15 19:18:50 | KEYWORDS: ubuntu, copy, find, extensions

Ubuntu locate all of an extension and copy to a directory 

This was used to find all .ipybn ( Ipython Notebook ) extensions in my computer and copying them to "/home/jack/python3-starter/misc/".

find . -type f -name "*.ipynb" -exec cp {} /home/jack/python3-starter/misc/ ;




Problem Starting Docker After Power outage



Article id- 306 | Date: 2017-03-15 19:13:56 | KEYWORDS: docker, problems,docker will not start, containers, power failure

Problem Starting Docker After Power outage 
jack@jack-desktop:~$ sudo dockerd
INFO[0000] libcontainerd: previous instance of containerd still alive (3064) 
INFO[0000] [graphdriver] using prior storage driver "aufs" 
ERRO[0002] Error during layer Store.Cleanup(): device or resource busy 
FATA[0002] Error starting daemon: timeout               
jack@jack-desktop:~$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
jack@jack-desktop:~$ docker ps
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
jack@jack-desktop:~$ sudo rm /var/run/docker.pid

jack@jack-desktop:~$ service docker restart

ALL IS WELL NOW (with Docker ) but there is more when running DeepDream!




Installing Anaconda in a docker container



Article id- 305 | Date: 2017-03-15 19:11:09 | KEYWORDS: Anaconda,docker container,docker,

Installing Anaconda in a docker container 
curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
The container did not have curl so :

root@2bd20662c982:/home# curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
bash: curl: command not found
root@2bd20662c982:/home# apt-get install curl
	
Now curl is installed .	

 curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
 ( the file is large 462M)
 The response will be something like this:
root@2bd20662c982:/home# curl -O https://repo.continuum.io/archive/Anaconda2-4.3.1-Linux-x86_64.sh
  %   Total   % Received   %  Xferd  Average  Speed      Time          Time     Time            Current
                                                            Dload   Upload    Total          Spent    Left                Speed
   3  462M   3        16.M     0        0        148k            0    0:02:20      0:16:24  0:26:24           250k   

Once the download is completed enter:

bash Anaconda2-4.3.1-Linux-x86_64.sh




Lots of ffmpeg commands I have used these on my Linux Box



Article id- 304 | Date: 2016-10-25 19:35:15 | KEYWORDS: ffmpeg, video capture, images, video, slideshow, add music

Lots of ffmpeg commands I have used these on my Linux Box  FFmpeg Information and Commands

FFmpeg Commands That Have Worked for Me

Record Sound only *.wav or *.mp3

ffmpeg -f alsa -i plughw:CARD=H3100,DEV=0 -acodec libmp3lame -t 20 output.wav ffmpeg -f alsa -i plughw:CARD=H3100,DEV=0 -acodec libmp3lame -t 20 output.MP3 BOTH worked fine for me.

Record video and sound This is from a HP3100 USB camera and microphone.

This works pretty good I think. I did not check the sync :
ffmpeg -f alsa -i pulse -f x11grab -r 17 -s 1360x760 -i :0.0 -acodec pcm_s16le catchit.mkv
ffmpeg -thread_queue_size 512 -f alsa -i pulse -f x11grab -r 17 -s 1280x720 -i :0.0 -acodec pcm_s16le 0001.mkv
ffmpeg -thread_queue_size 768 -f alsa -i pulse -f x11grab -r 17 -s 1280x720 -i :0.0 -acodec pcm_s16le 0001.mkv

I WILL USE THIS SREEN RECORDER

 - NO ERRORS GREAT RECORDING - Works well with Gimp and Blender ;
works with HP3100 microphone or with headsets:
ffmpeg -thread_queue_size 768 -f alsa -i pulse -f x11grab -r 17 -s 1360x760 -i :0.0 -preset ultrafast -acodec pcm_s16le 0003.mkv experimental:
ffmpeg -f alsa -r 16000 -i hw:2,0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -qscale 0 -acodec libmp3lame -ab 96k output.avi ffmpeg -f alsa -r 16000 -i plughw:CARD=H3100,DEV=0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -qscale 0 -acodec libmp3lame -ab 96k output.mp4 ffmpeg -f alsa -i plughw:CARD=H3100,DEV=0 -acodec libmp3lame -ab 96k -s hd720 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast desktop.mkv

Ffmpeg may be used with no options

The i- following ffmpeg proceeds the file name. The simple command below uses same size and the frame rate defaults to 25 ( -framerate 25 ).


ffmpeg -i infile.avi youroutput.mp4
If you wish to keep the frame sizes and frame rate intact use the -strict option. it results in a high quality video if possible.
ffmpeg -i input.avi -strict -2 output.mp4
ffmpeg -i input.mkv -codec copy output.mp4

Good Screen Capture - NO errors

ffmpeg -f x11grab -r 17 -s 1360x760 -i :0.0 -vcodec libx264 -preset ultrafast test001.mp4
Good HAS ERRORS: ffmpeg -video_size 1360x760 -framerate 25 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast another-capture.mkv

Stabilize a video:


ffmpeg -i input.mov -vf deshake output.mov

Cropping a video - I have used this

ffmpeg -i FinalFish.mp4 -filter:v "crop=1024:1141:0:465" Fishout2.mp4

Then I used:
ffmpeg -i Fishout2.mp4 -vf scale=1024:1024 1024.mp4
I used that to "square up" the video for instagram.

To make animated gifs with Image Magic

convert -delay 20 -loop *.png test.gif

Screen Capture using ffmpeg

works with headset:
shows warnings but works fine
ffmpeg -framerate 25 -video_size 1360x760 -f x11grab -i :0.0 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.mkv
works with warnings:
shows even more warnings but works fine
ffmpeg -framerate 17 -s hd720 -f x11grab -i :0.0 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le motest.mkv

works with my hp3100 WebCam

ffmpeg -thread_queue_size 512 -f alsa -ac 1 -ar 48000 -i plughw:CARD=H3100,DEV=0 -s 1366x768 -f x11grab -i :0 -r 30 -vcodec libx264 testit.mkv

the HP3100 Webcam option

-i plughw:CARD=H3100,DEV=0
GOOD ( no audio ) !!
Lossless recording
ffmpeg -video_size 1360x750 -framerate 17 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast desktop2.mkv
-qp 0 tells x264 to encode in lossless mode and the -preset ultrafast instructs 'do it fast' fast.
This captured the camera ...
ffmpeg -i /dev/video0 -c:v libx264 -preset fast /home/jack/Desktop/CAM001.mp4 ffmpeg -f x11grab -s hd720 -r 25 -i :0.0+10,20 hd720.mp4 beautiful lossless screen capture:
ffmpeg -video_size 1360x760 -framerate 17 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast capture3.mp4

Videos from images

This one works best:
ffmpeg -framerate 1 -i paper%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

ffmpeg -r 60 -f image2 -s 1000x1000 -i %04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p testspace.mp4
ffmpeg -r 17 -f image2 -s 1000x1000 -i %04d.png -vcodec libx264 -crf 17 -pix_fmt yuv420p testspace2.mp4
The encoder should be fast enough on most modern hardware to record without any framedrop, and even leave enough CPU headroom for other applications. If you're going to archive the recording or are concerned about file size, re-encode it losslessly again but with a slower preset. Note that since the initial recording was lossless, and the re-encode is lossless too, no quality loss is introduced in this process in any way.
ffmpeg -i desktop.mkv -c:v libx264 -qp 0 -preset veryslow smaller_size_desktop.mkv
See Encode/H.264 for more info and examples.
Linux:
Use the x11grab device:
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4
This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) with the width and height of 1024x768.
If you need audio too you can use ALSA (see Capture/ALSA for more info):
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 output.mkv
Or the pulse input device:
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f pulse -ac 2 -i default output.mkv

Adding Subtitles

Both worked fine - mkvmerge and ffmpeg
mkvmerge -o output1000.mp4 1000.mp4 image.srt
The last one used - The video was good to upload to Instagram with Subtitles 650x650
ffmpeg -i 650.mp4 -vf subtitles=images.srt srtout.mp4 ffmpeg -i infile.mp4 -f srt -i infile.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
two videos side by side ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4

This essentially doubles the size of input1.mp4 by padding the right side with black the same size as the original video, and then places input2.mp4 over the top of that black area with the overlay filter.



Adding Music


I have used this it works fine on my linux Box


ffmpeg -i vid4.mp4 -i theCalling.mp3 -c copy -map 0:0 -map 1:0 -shortest vid4sound.mp4

Ubuntu Linux - Video on Video - FFmpeg

one extremely lone command line

ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=640x480 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=640x480 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=640x480 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=640 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=480 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=640:y=480" -s 1000x1000 -framerate 17 -c:v libx264 space.mkv
space.mkv

WORKS good location everything

 ffmpeg -i starout.mp4 -i Dance.mp4 -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000  [upperleft];  [1:v] setpts=PTS-STARTPTS, scale=250x250 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][lowerright] overlay=shortest=1:x=700:y=700" -s 1000x1000 -framerate 17 -c:v libx264 vidonvid.mp4






ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=410x307 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=410x307 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=410 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=410 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=410:y=307" -s 1000x1000 -framerate 17 -c:v libx264 space2.mkv
space2_0.mkv





ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=500x375 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=0:x=500:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space3_0.mkv
space3_0.mkv



ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=500:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space4_0.mkv
space4_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space5_0.mkv
space5_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=620" -s 1000x1000 -framerate 17 -c:v libx264 space6_0.mkv
space6_0.mkv Speed up a video 11.14 min into 58 sec ffmpeg -i acorn001.mp4 -r 16 -filter:v "setpts=0.07*PTS" slowoutput2.mp4 1/2 length - ffmpeg -i acorn001.mp4 -r 16 -filter:v "setpts=0.5*PTS" slowoutput2.mp4 ffmpeg -i vidonvidlong.mpg -vf subtitles=space.srt xxxxx.mp4 ffmpeg -i vidonvid3.mpg -vf subtitles=space.srt instaxxx.mp4
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=589:y=693" -s 1000x1000 -framerate 17 -c:v libx264 space7_0.mkv
space7_0.mkv
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=410x307 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=569:y=673" -s 1000x1000 -framerate 17 -c:v libx264 space8_0.mkv

Notice changing -- overlay=shortest=1:x=569:y=673" gave a 20 pixal border on the bottom and right side to the third video.

space8_0.mkv

The Understanding:
ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; 
[0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; 
[1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; 
[2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft];
[3:v] setpts=PTS-STARTPTS, scale=500x375 [lowerright]; 
[base][upperleft] overlay=shortest=1 [tmp1]; 
[tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; 
[tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; 
[tmp3][lowerright] overlay=shortest=1:x=410:y=307" -s 1000x1000 -framerate 17 -c:v libx264 space4_0.mkv

ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; 
[0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; 
[1:v] setpts=PTS-STARTPTS, scale=500x375 [upperright]; 
[2:v] setpts=PTS-STARTPTS, scale=500x375 [lowerleft];
[3:v] setpts=PTS-STARTPTS, scale=410x303 [lowerright]; 
[base][upperleft] overlay=shortest=1 [tmp1]; 
[tmp1][upperright] overlay=shortest=1:x=500 [tmp2]; 
[tmp2][lowerleft] overlay=shortest=1:y=500 [tmp3]; 
[tmp3][lowerright] overlay=shortest=1:x=500:y=375" -s 1000x1000 -framerate 17 -c:v libx264 space4_0.mkv








Requires:
Space.mp4
2a.mkv
1a.mkv 
desktop.mkv
 terminal output:

jack@jack-desktop:~/Desktop/TRASH/keep$ cd instagram
jack@jack-desktop:~/Desktop/TRASH/keep/instagram$ ffmpeg -i Space.mp4 -i 2a.mkv -i 1a.mkv -i desktop.mkv -filter_complex "nullsrc=size=1000x1000 [base]; [0:v] setpts=PTS-STARTPTS, scale=1000x1000 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=640x480 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=640x480 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=640x480 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=640 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=480 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=640:y=480" -s 1000x1000 -framerate 17 -c:v libx264 space.mkv

ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Space.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.36.100
  Duration: 00:00:16.47, start: 0.000000, bitrate: 2772 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1000x1000 [SAR 1:1 DAR 1:1], 2769 kb/s, 17 fps, 17 tbr, 16k tbn, 34 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler
Input #1, matroska,webm, from '2a.mkv':
  Metadata:
    COMPATIBLE_BRANDS: isomiso2avc1mp41
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 512
    ENCODER         : Lavf56.36.100
  Duration: 00:00:31.20, start: 0.000000, bitrate: 415 kb/s
    Stream #1:0(und): Video: h264 (High 4:2:2), yuv422p, 640x360, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 20 tbc (default)
    Metadata:
      LANGUAGE        : und
      HANDLER_NAME    : VideoHandler
      ENCODER         : Lavc56.41.100 libx264
Input #2, matroska,webm, from '1a.mkv':
  Metadata:
    ENCODER         : Lavf56.36.100
  Duration: 00:01:04.12, start: 0.000000, bitrate: 141 kb/s
    Stream #2:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 640x480 [SAR 4:3 DAR 16:9], 17 fps, 17 tbr, 1k tbn, 34 tbc (default)
    Metadata:
      ENCODER         : Lavc56.41.100 libx264
    Stream #2:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
    Metadata:
      ENCODER         : Lavc56.41.100 libvorbis
Input #3, matroska,webm, from 'desktop.mkv':
  Metadata:
    ENCODER         : Lavf56.36.100
  Duration: 00:00:45.37, start: 0.000000, bitrate: 6570 kb/s
    Stream #3:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 1360x750, SAR 1:1 DAR 136:75, 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      ENCODER         : Lavc56.41.100 libx264
[libx264 @ 0x1d02fa0] using SAR=1/1
[libx264 @ 0x1d02fa0] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 0x1d02fa0] profile High, level 3.2
[libx264 @ 0x1d02fa0] 264 - core 146 r2555 0c21480 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'space.mkv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.36.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1000x1000 [SAR 1:1 DAR 1:1], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.41.100 libx264
    Stream #0:1: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp (default)
    Metadata:
      encoder         : Lavc56.41.100 libvorbis
    Stream #0:2(und): Subtitle: ass, 1000x1000 (default)
    Metadata:
      handler_name    : SubtitleHandler
      encoder         : Lavc56.41.100 ass
Stream mapping:
  Stream #0:0 (h264) -> setpts (graph 0)
  Stream #1:0 (h264) -> setpts (graph 0)
  Stream #2:0 (h264) -> setpts (graph 0)
  Stream #3:0 (h264) -> setpts (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #2:1 -> #0:1 (vorbis (native) -> vorbis (libvorbis))
  Stream #0:1 -> #0:2 (mov_text (native) -> ass (native))
Press [q] to stop, [?] for help
[libvorbis @ 0x1d03a40] Queue input is backward in time
    Last message repeated 7 times
[libvorbis @ 0x1d03a40] Queue input is backward in time.31 bitrate= 143.3kbits/s    
    Last message repeated 4 times
[libvorbis @ 0x1d03a40] Queue input is backward in time5.70 bitrate=1253.3kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time6.93 bitrate=1418.9kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time9.72 bitrate=1380.9kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time3.07 bitrate=1353.3kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time4.30 bitrate=1322.8kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time4.59 bitrate=1313.5kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time6.26 bitrate=1210.3kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time8.05 bitrate=1090.4kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time4.22 bitrate= 857.4kbits/s    
[libvorbis @ 0x1d03a40] Queue input is backward in time9.61 bitrate= 719.4kbits/s    
    Last message repeated 1 times
[libvorbis @ 0x1d03a40] Queue input is backward in time2.21 bitrate= 526.4kbits/s    
    Last message repeated 1 times
[libvorbis @ 0x1d03a40] Queue input is backward in time0.58 bitrate= 388.7kbits/s    
[matroska @ 0x1bed240] Starting new cluster due to timestampbitrate= 386.2kbits/s    
frame=  411 fps= 11 q=-1.0 Lsize=    3171kB time=00:01:01.11 bitrate= 425.1kbits/s    
video:2621kB audio:521kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.919914%
[libx264 @ 0x1d02fa0] frame I:2     Avg QP:19.76  size:152572
[libx264 @ 0x1d02fa0] frame P:128   Avg QP:20.18  size: 15141
[libx264 @ 0x1d02fa0] frame B:281   Avg QP:25.79  size:  1566
[libx264 @ 0x1d02fa0] consecutive B-frames:  6.6%  1.5% 16.1% 75.9%
[libx264 @ 0x1d02fa0] mb I  I16..4: 14.5% 41.5% 44.0%
[libx264 @ 0x1d02fa0] mb P  I16..4:  1.4%  2.9%  1.0%  P16..4: 22.2%  9.5%  6.4%  0.0%  0.0%    skip:56.6%
[libx264 @ 0x1d02fa0] mb B  I16..4:  0.1%  0.3%  0.1%  B16..8: 15.8%  1.3%  0.2%  direct: 0.4%  skip:81.8%  L0:39.9% L1:52.7% BI: 7.3%
[libx264 @ 0x1d02fa0] 8x8 transform intra:54.7% inter:60.8%
[libx264 @ 0x1d02fa0] coded y,uvDC,uvAC intra: 52.8% 56.8% 23.6% inter: 6.3% 4.9% 0.2%
[libx264 @ 0x1d02fa0] i16 v,h,dc,p: 22% 44%  7% 27%
[libx264 @ 0x1d02fa0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 12% 27%  5%  6%  5%  5%  5%  6%
[libx264 @ 0x1d02fa0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 27% 15%  4%  6%  5%  6%  5%  6%
[libx264 @ 0x1d02fa0] i8c dc,h,v,p: 54% 28% 16%  3%
[libx264 @ 0x1d02fa0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x1d02fa0] ref P L0: 66.1% 12.9% 13.0%  8.0%
[libx264 @ 0x1d02fa0] ref B L0: 91.6%  5.8%  2.6%
[libx264 @ 0x1d02fa0] ref B L1: 96.0%  4.0%
[libx264 @ 0x1d02fa0] kb/s:1305.78
jack@jack-desktop:~/Desktop/TRASH/keep/instagram$ 

To View the video information on a video called 'SpaceSubtitle_ffmpeg.mp4':

ffprobe -v error -show_format -show_streams SpaceSubtitle_ffmpeg.mp4
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High 4:4:4 Predictive
codec_type=video
codec_time_base=1/34
codec_tag_string=avc1
codec_tag=0x31637661
width=1000
height=1000
coded_width=1008
coded_height=1008
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=1:1
pix_fmt=yuv444p
level=32
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
timecode=N/A
refs=4
is_avc=1
nal_length_size=4
id=N/A
r_frame_rate=17/1
avg_frame_rate=2240000/131757
time_base=1/16000
start_pts=0
start_time=0.000000
duration_ts=263514
duration=16.469625
bit_rate=2769392
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=280
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=mov_text
codec_long_name=3GPP Timed Text subtitle
profile=unknown
codec_type=subtitle
codec_time_base=1/1000
codec_tag_string=tx3g
codec_tag=0x67337874
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=16470

----- end of response ---

Another File information command

The command below command is no designed to be a file information command, however it works as one. As you see it provides some erroneous information and concludes with an error "At least one output file must be specified". Ffprobe is the desired means of acquiring information.


jack@jack-desktop:~/blender$ ffmpeg -i SpaceSubtitle_ffmpeg.mp4ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
  configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'SpaceSubtitle_ffmpeg.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.36.100
  Duration: 00:00:16.47, start: 0.000000, bitrate: 2772 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1000x1000 [SAR 1:1 DAR 1:1], 2769 kb/s, 17 fps, 17 tbr, 16k tbn, 34 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler
At least one output file must be specified

EXPERIMENT To show streaming video in a port. ffmpeg -i /dev/video0 -listen 1 -f matroska -c:v libx264 -preset fast -tune zerolatency http://:8080 ffplay http://localhost:8080/ See the scale and unsharp filters in ffmpeg: ffmpeg -i input -filter:v "scale=1280:-1,unsharp=5:5:1.0:5:5:0.0" output The -1 in the scale filter tells ffmpeg to automatically choose the correct height to preserve aspect ratio. You can change the scaler with the -sws_flags option, such as -sws_flags lanczos. For upsampling lanczos is worth trying. Default is bicubic. See the full list at ffmpeg -h full. The results of: ffmpeg -i infile.avi youroutput.mp4 ffmpeg lists each frame as it converts it. I am showing only the last 100 frames. frame= 5410 fps= 15 q=29.0 size= 57761kB time=00:03:00.95 bitrate=2614.9kbits/ frame= 5419 fps= 15 q=29.0 size= 57837kB time=00:03:00.95 bitrate=2618.4kbits/ frame= 5428 fps= 15 q=29.0 size= 57912kB time=00:03:00.95 bitrate=2621.8kbits/ frame= 5436 fps= 15 q=29.0 size= 57983kB time=00:03:01.95 bitrate=2610.6kbits/ frame= 5445 fps= 15 q=29.0 size= 58047kB time=00:03:01.95 bitrate=2613.5kbits/ frame= 5453 fps= 15 q=29.0 size= 58147kB time=00:03:01.95 bitrate=2617.9kbits/ frame= 5459 fps= 15 q=29.0 size= 58242kB time=00:03:01.95 bitrate=2622.2kbits/ frame= 5467 fps= 15 q=29.0 size= 58342kB time=00:03:02.95 bitrate=2612.4kbits/ frame= 5476 fps= 15 q=29.0 size= 58423kB time=00:03:02.95 bitrate=2616.0kbits/ frame= 5485 fps= 15 q=29.0 size= 58497kB time=00:03:02.95 bitrate=2619.4kbits/ frame= 5493 fps= 15 q=29.0 size= 58565kB time=00:03:03.94 bitrate=2608.1kbits/ frame= 5501 fps= 15 q=29.0 size= 58637kB time=00:03:03.94 bitrate=2611.3kbits/ frame= 5509 fps= 15 q=29.0 size= 58706kB time=00:03:03.94 bitrate=2614.4kbits/ frame= 5515 fps= 15 q=29.0 size= 58766kB time=00:03:03.94 bitrate=2617.1kbits/ frame= 5520 fps= 15 q=-1.0 Lsize= 59421kB time=00:03:04.01 bitrate=2645.3kbits /s speed=0.492x video:56347kB audio:2878kB subtitle:0kB other streams:0kB global headers:0kB mux ing overhead: 0.331550% [libx264 @ 00000000005397c0] frame I:23 Avg QP:21.33 size: 66958 [libx264 @ 00000000005397c0] frame P:1390 Avg QP:24.19 size: 22546 [libx264 @ 00000000005397c0] frame B:4107 Avg QP:27.28 size: 6043 [libx264 @ 00000000005397c0] consecutive B-frames: 0.7% 0.2% 0.3% 98.8% [libx264 @ 00000000005397c0] mb I I16..4: 6.2% 91.2% 2.6% [libx264 @ 00000000005397c0] mb P I16..4: 2.9% 12.3% 0.3% P16..4: 57.7% 14.0 % 8.1% 0.0% 0.0% skip: 4.7% [libx264 @ 00000000005397c0] mb B I16..4: 0.3% 1.5% 0.0% B16..8: 33.6% 3.9 % 0.7% direct: 4.5% skip:55.3% L0:48.2% L1:45.6% BI: 6.2% [libx264 @ 00000000005397c0] 8x8 transform intra:80.5% inter:85.6% [libx264 @ 00000000005397c0] coded y,uvDC,uvAC intra: 65.8% 92.4% 23.0% inter: 1 4.7% 37.0% 1.2% [libx264 @ 00000000005397c0] i16 v,h,dc,p: 12% 15% 4% 69% [libx264 @ 00000000005397c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 18% 23% 4% 7% 8% 7% 6% 7% [libx264 @ 00000000005397c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 13% 5% 12% 10% 9% 5% 4% [libx264 @ 00000000005397c0] i8c dc,h,v,p: 49% 14% 27% 9% [libx264 @ 00000000005397c0] Weighted P-Frames: Y:3.0% UV:1.4% [libx264 @ 00000000005397c0] ref P L0: 35.0% 13.2% 34.3% 17.3% 0.2% [libx264 @ 00000000005397c0] ref B L0: 84.1% 10.5% 5.4% [libx264 @ 00000000005397c0] ref B L1: 95.7% 4.3% [libx264 @ 00000000005397c0] kb/s:2508.66 [aac @ 00000000005b9f80] Qavg: 943.549 ~Desktop$:/DCIM/Ffugi ffmpeg -i sharpenstress.mp4 -framerate 30000/1001 -loop 1 -i stress.png -filter_complex "[1:v] fade=out:30:d=1 alpha=1 [ov]; [0:v][ov] overlay=10:10 [v]" -map "[v]" -map 0:a -c:v libxx264 -c:a copy -shortest textover.mp4" ffmpeg -i sharpenstress.mp4 -framerate 30000/1001 -loop 1 -i stress.png -filter_complex "[1:v] fade=out:st=30:d=1:alpha=1 [ov]; [0:v][ov] overlay=10:10 [v]" -map "[v]" -c:v libx264 -c:a copy -shortest stressover.mp4
References: https://trac.ffmpeg.org/wiki/Encode/H.264 https://ffmpeg.org/ https://wiki.archlinux.org/index.php/FFmpeg


Capturing video with sound using Ubuntu Vokoscreen 2.4



Article id- 303 | Date: 2016-09-22 21:26:16 | KEYWORDS: screencapture, Vokoscreen, Ubuntu, Capturing video, capture

Capturing video with sound using Ubuntu Vokoscreen 2.4 

Ubuntu Vokoscreen 2.4

Nice Ubuntu program - One item of mention is the choice to capture microphone audio, computer audio or the mix of both:
[Built in Audio Analog Stereo] is the microphone
[Monitor of Built in Audio Analog Stereo] is the computer ( a movie or prerecordered sound playing )
BOTH checked
Plays the background AND records from the microphone at the same time.

I have tried several recorders. The truth is they all use ffmpeg to 'do the job'. SO, if you are familiar with using the command lines. FFmpeg is the direct and lowest overhead of all.

A file I posted with additional FFmpeg Information: FFmpeg


Converting AVI Video to MP4



Article id- 301 | Date: 2016-09-19 19:33:24 | KEYWORDS: ffmpeg, convert video, mp4, avi

Converting AVI Video to MP4 

To View the video information


ffmpeg -i infile.avi result of this command:

At it's similist Usage


ffmpeg -i infile.avi youroutput.mp4

That is the simpilist usage and should keep the frame sizes and frame rate intact.

ffmpeg -i input.avi -strict -2 output.mp4

Resuilts in a high quality video if possible.

Stabilize a video


ffmpeg -i input.mov -vf deshake output.mov

Screen Capture using ffmpeg

Windows:


 Use a DirectShow ​device:

ffmpeg -f dshow -i video="screen-capture-recorder" output.flv

This will grab the image from entire desktop. You can refer to a ​list of alternative devices.

If you need audio too:

ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone" output.flv

If you want to capture the audio that is playing from your speakers you may also need to configure so-called "Stereo Mix" device.

or

ffmpeg -f dshow -i video="UScreenCapture" -f dshow -i audio="Microphone" output.flv

You can list your devices with:

ffmpeg -list_devices true -f dshow -i dummy

There is also the gdigrab input device you can use to grab video from the screen in Windows.
General notes

If you have a slow computer, it will not be smart to grab and encode your video at the same time, because slow CPU will not be able to do this. In that case, first grab all you need and save it as uncompressed video/audio and when you finish the grabbing process then start converting it to whatever you need:

Linux:

ffmpeg -framerate 25 -video_size 1024x768 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.mkv
ffmpeg -i output.mkv -acodec ... -vcodec ... final.mkv

Windows:

ffmpeg -f dshow -i video="screen-capture-recorder":audio="Microphone" -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.mkv
ffmpeg -i output.flv -acodec ... -vcodec ... final.mkv

Lossless recording

If you want a perfect recording of your desktop, x264 can help. Use lossless encoding, e.g.:

ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast capture.mkv

-qp 0 tells x264 to encode in lossless mode, -preset ultrafast advises it to do so fast.

The encoder should be fast enough on most modern hardware to record without any framedrop, and even leave enough CPU headroom for other applications.

If you're going to archive the recording or are concerned about file size, re-encode it losslessly again but with a slower preset. Note that since the initial recording was lossless, and the re-encode is lossless too, no quality loss is introduced in this process in any way.

ffmpeg -i capture.mkv -c:v libx264 -qp 0 -preset veryslow capture_smaller.mkv

See Encode/H.264 for more info and examples. 

Linux:

 Use the x11grab device:

ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4

This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) with the width and height of 1024x768.

If you need audio too you can use ALSA (see Capture/ALSA for more info):

ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 output.mkv

Or the pulse input device:

ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f pulse -ac 2 -i default output.mkv

EXPERIMENT


To show streaming video in a port.

ffmpeg -i /dev/video0 -listen 1 -f matroska -c:v libx264 -preset fast -tune zerolatency http://:8080 ffplay http://localhost:8080/ The results of:
ffmpeg -i infile.avi youroutput.mp4
ffmpeg lists each frame as it converts it.  I am showing onlyy the last 100 frames.

frame= 5410 fps= 15 q=29.0 size=   57761kB time=00:03:00.95 bitrate=2614.9kbits/
frame= 5419 fps= 15 q=29.0 size=   57837kB time=00:03:00.95 bitrate=2618.4kbits/
frame= 5428 fps= 15 q=29.0 size=   57912kB time=00:03:00.95 bitrate=2621.8kbits/
frame= 5436 fps= 15 q=29.0 size=   57983kB time=00:03:01.95 bitrate=2610.6kbits/
frame= 5445 fps= 15 q=29.0 size=   58047kB time=00:03:01.95 bitrate=2613.5kbits/
frame= 5453 fps= 15 q=29.0 size=   58147kB time=00:03:01.95 bitrate=2617.9kbits/
frame= 5459 fps= 15 q=29.0 size=   58242kB time=00:03:01.95 bitrate=2622.2kbits/
frame= 5467 fps= 15 q=29.0 size=   58342kB time=00:03:02.95 bitrate=2612.4kbits/
frame= 5476 fps= 15 q=29.0 size=   58423kB time=00:03:02.95 bitrate=2616.0kbits/
frame= 5485 fps= 15 q=29.0 size=   58497kB time=00:03:02.95 bitrate=2619.4kbits/
frame= 5493 fps= 15 q=29.0 size=   58565kB time=00:03:03.94 bitrate=2608.1kbits/
frame= 5501 fps= 15 q=29.0 size=   58637kB time=00:03:03.94 bitrate=2611.3kbits/
frame= 5509 fps= 15 q=29.0 size=   58706kB time=00:03:03.94 bitrate=2614.4kbits/
frame= 5515 fps= 15 q=29.0 size=   58766kB time=00:03:03.94 bitrate=2617.1kbits/
frame= 5520 fps= 15 q=-1.0 Lsize=   59421kB time=00:03:04.01 bitrate=2645.3kbits
/s speed=0.492x
video:56347kB audio:2878kB subtitle:0kB other streams:0kB global headers:0kB mux
ing overhead: 0.331550%
[libx264 @ 00000000005397c0] frame I:23    Avg QP:21.33  size: 66958
[libx264 @ 00000000005397c0] frame P:1390  Avg QP:24.19  size: 22546
[libx264 @ 00000000005397c0] frame B:4107  Avg QP:27.28  size:  6043
[libx264 @ 00000000005397c0] consecutive B-frames:  0.7%  0.2%  0.3% 98.8%
[libx264 @ 00000000005397c0] mb I  I16..4:  6.2% 91.2%  2.6%
[libx264 @ 00000000005397c0] mb P  I16..4:  2.9% 12.3%  0.3%  P16..4: 57.7% 14.0
%  8.1%  0.0%  0.0%    skip: 4.7%
[libx264 @ 00000000005397c0] mb B  I16..4:  0.3%  1.5%  0.0%  B16..8: 33.6%  3.9
%  0.7%  direct: 4.5%  skip:55.3%  L0:48.2% L1:45.6% BI: 6.2%
[libx264 @ 00000000005397c0] 8x8 transform intra:80.5% inter:85.6%
[libx264 @ 00000000005397c0] coded y,uvDC,uvAC intra: 65.8% 92.4% 23.0% inter: 1
4.7% 37.0% 1.2%
[libx264 @ 00000000005397c0] i16 v,h,dc,p: 12% 15%  4% 69%
[libx264 @ 00000000005397c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 18% 23%  4%  7%
 8%  7%  6%  7%
[libx264 @ 00000000005397c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 19% 13%  5% 12%
10%  9%  5%  4%
[libx264 @ 00000000005397c0] i8c dc,h,v,p: 49% 14% 27%  9%
[libx264 @ 00000000005397c0] Weighted P-Frames: Y:3.0% UV:1.4%
[libx264 @ 00000000005397c0] ref P L0: 35.0% 13.2% 34.3% 17.3%  0.2%
[libx264 @ 00000000005397c0] ref B L0: 84.1% 10.5%  5.4%
[libx264 @ 00000000005397c0] ref B L1: 95.7%  4.3%
[libx264 @ 00000000005397c0] kb/s:2508.66
[aac @ 00000000005b9f80] Qavg: 943.549

C:UsersUSERDesktopDCIMFUGI>


References: https://ffmpeg.org/ https://wiki.archlinux.org/index.php/FFmpeg


JavaScript animation using sprites



Article id- 300 | Date: 2016-09-08 08:00:29 | KEYWORDS: sprites, animation, javascript

JavaScript animation using sprites SpriteAnimation
This is a short animation with music.


JavaScript animation using sprites



Article id- 299 | Date: 2016-09-08 08:00:13 | KEYWORDS: sprites, animation, javascript

JavaScript animation using sprites SpriteAnimation
This is a short animation with music.


Epistlerblogs.com/fish



Article id- 298 | Date: 2016-08-31 20:17:47 | KEYWORDS: app, fish, kiss, fish kiss, fishkiss

Epistlerblogs.com/fish This is an online game as well as an Android App that may be played off line. Android Apk is downloadable here. FISH APP. Download and enjoy. You will of course get a warning because the app is not from the Google App Store. It is safe.


Using touchstart, touchend, javascript



Article id- 296 | Date: 2016-08-16 23:19:32 | KEYWORDS: touchstart, touchend, javascript

Using touchstart, touchend, javascript 

Using touchstart, touchend, javascript


----- start javascript
$(document).ready(function() {
    $('.hover').bind('touchstart touchend', function(e) {
        e.preventDefault();
        $(this).toggleClass('hover_effect');
    });
});
----------end javascript

start style
.menu-button {
    position: relative;
    float:left;
    width:auto;
}

.dropdown-box  {
    display: none;
    position: absolute;   
}
.menu-button:focus > .dropdown-box,
.menu-button:hover > .dropdown-box
{ display:block; background-color:red; }

.menu-button a:focus + .dropdown-box,
.menu-button a:hover + .dropdown-box
{ display:block; background-color:darkorange; }

.menu-button.hover_effect > .dropdown-box,
.menu-button a.hover_effect + .dropdown-box
{ display:block; background-color:purple; }

p {color:gray;}
p:hover {color:black;}
p.hover_effect {color:red;}


.dropdown-box:hover,
.dropdown-box.hover_effect
{ display:block; }

/* visual menu styles */
.menu-button:focus {outline: none;}
.menu-button {margin:2px; background-color:#141414; padding:5px; color:#dadada;}
.dropdown-box  {background-color:#333333; width:90px; padding:0px; text-decoration:none; color:#DADADA;}
.dropdown-box li {border-bottom:solid 1px #444444; padding:5px;}

/* page styles */
.top-space {padding:60px 0 10px 0; clear:both;}
a {display:block; text-decoration:none; color:#DADADA;}
ul, li {border:0; padding:0; margin:0; list-style:none;}
----- end style

When you start or end a touch, turn the class "hover_effect" on or off - from StackOverflow question: http://stackoverflow.com/questions/2851663/how-do-i-simulate-a-hover-with-a-touch-in-touch-enabled-browsers




Using Touchstart and JavaScript Buttons



Article id- 293 | Date: 2016-08-16 23:02:37 | KEYWORDS: Using Touchstart, JavaScript, Buttons

Using Touchstart and JavaScript Buttons 

Using Touchstart, JavaScript, Buttons

function startTouch(ev) { alert("this is a response") } function init() { var el=document.getElementById("target1"); el.ontouchstart = startTouch; }




Touch me ...






Touch me ...





Article id- 292 | Date: 2016-08-13 23:14:26 | KEYWORDS:

 

test

function innerhtml() {
document.getElementById("demo").innerHTML = "document.getElementById('demo').innerHTML";
}


test

function myFunctionA() {
    document.getElementById("demo2").innerHTML = "Hello World";
}


COLOR TEST

function myFunction() {
    var x = document.getElementById("demo3");
    x.style.color = "red";
    x.style.font, size = 50;
}

test


function myFunctionB() { var xx = document.getElementsByTagName("STYLE")[0]; document.getElementById("demo5").innerHTML = xx.innerHTML; }

test



function myFunctionC() { var x = document.createElement("STYLE"); var t = document.createTextNode("body {font: 20px verdana;}"); x.appendChild(t); document.head.appendChild(x); }

Reference W3School



Resources for Java Tips and Scripts



Article id- 290 | Date: 2016-07-30 21:25:17 | KEYWORDS: Resources, Java, Scripts

Resources for Java Tips and Scripts 

Resources for Java Tips and Scripts

<button onclick="heyDude()">heyDude</button>
<script>
function heyDude() {
alert("This is my heyDude function and how you get a line feed if you need one.");
} </script>


https://wiki.alfresco.com/wiki/JavaScript_API_Cookbook http://www.w3schools.com/js/js_functions.asp https://www.sitepoint.com/shorthand-javascript-techniques/


javascript-animation-code-write-to-screen



Article id- 287 | Date: 2016-07-30 18:45:01 | KEYWORDS: javascript, animation, code, write, screen

javascript-animation-code-write-to-screen 

Generating Random Numbers

Random numbers are an important part of any game. They can provide numbers to control timers, movement, size, visibility, angles, any information that is not static must be generated 'random'. Without random numbers the ability of games would be would be very limited. Here I will show a few ways to generate random numbers. That will lead us into PIDs, variators, steppers and floats.

Display a Random Snail Speed in Miles Per Month.


Auto-Generated Random Numbers

The small black number was randomly generated when you loaded the page. Any reload will provide a new random number. The random numbers generated are between 0 and 1. The 0 is inclusive the 1 is not.

To get a random number from 0 to 100, you multiply 100 by the random number generated by the computer. The number generated will probably contain a decimal as illustrated in RED. The red number also was randomly generated when you loaded the page.


Random Whole Number Example

The big big 'gray' has nothing to do with the random number stuff. Thought you might be bored of the plain ol' numbers. So I beefed up the looks. A bit of CSS make-up. This random number is from 1 to . Huh ! . Magically match the range of lottery numbers. You win a million bucks email me.



Break the Boredom Make Something Move

This set designed to start with a button click, HOWEVER, it is 'duck soup easy' ( that means very easy ) to make it start to move when the page is loaded. Just use:


window.onload = function start { slidit(); }

slidit() being the function I would auto-start.


// if the three lines below are enabled the function slideit() will start automatically // no startbutton is required.
SomeText





?>