As a result, Ciro Santilli who likes "lower level stuff", has had many many hours if image manipulation fun with this software, see e.g.:
As older Ciro grows, the more he notices that FFmpeg can do basically any lower level audio video task. It is just an amazing piece of software, the immediate go-to for any low level operation.
Resize a video: superuser.com/questions/624563/how-to-resize-a-video-to-make-it-smaller-with-ffmpeg:Unlike every other convention under the sun, the height in
ffmpeg -i input.avi -filter:v scale=720:-1 -c:a copy output.mkvscale is the first number.Filter graphs are a thing of great beauty. What an amazingly obscure domain-specific language, but which can produce striking results with very little!!!
A quick example from stackoverflow.com/questions/59551013/how-to-generate-stereo-sine-wave-using-ffmpeg-with-different-frequencies-for-eac/77730492#77730492 illustrates some of the fundamentals:
ffplay -autoexit -nodisp -f lavfi -i '
sine=frequency=500[a];
sine=frequency=1000[b];
[a][b]amerge, atrim=end=2
' +--------+
[sine=frequency=500]--->[a]-->| |
| amerge |-->[atrim]-->[output]
[sine=frequency=1000]-->[b]-->| |
+--------+So we see the following syntax patterns:
sine,amergeandatrimare filterssine=frequency=500: the first=says "araguments follow";: separates statements[a],[b]: sets the name of an edge,: creates unnamed edge between filters that have one input and one output
A list of all filters can be obtained ith:and parameters for a single filter can be obtained with:Related question: stackoverflow.com/questions/69251087/in-ffmpeg-command-line-how-to-show-all-filter-settings-and-their-parameters-bef
ffmpeg -filtersffmpeg --help filter=sineTODO dump graph to ASCII art? trac.ffmpeg.org/wiki/FilteringGuide#Visualizingfilters mentions a
-dumpgraph option, but haven't managed to use it yet.Bibliography:
- ffmpeg.org/ffmpeg-filters.html official documentation
- trac.ffmpeg.org/wiki/FilteringGuide some handy tips from the FFMpeg Wiki
Awesome tool to view quick stuff quickly without generating files. Unfortunately it doesn't support all options that the ffmpeg CLI supports, e.g. ffplay multiple input files. One day, one day.
TODO possible? superuser.com/questions/559768/ffplay-how-to-play-together-separate-video-and-audio-files
For synthesized streams like but it does not seem to accept multiple fails with:
sine we can do it e.g.ffplay -autoexit -nodisp -f lavfi -i '
sine=frequency=500[a];
sine=frequency=1000[b];
[a][b]amerge, atrim=end=2
'-i for some reason. So is there a way to open a file from some filter? E.g.:ffplay -i tmp.wav -i tmp.mkv -filter_complex "[0:a]atrim=end=2[a];[1:v]trim=end=2[v]" -map '[a]' -map '[v]'Argument 'tmp.mkv' provided as input filename, but 'tmp.wav' was already specified.Simple sines and variants:
- unix.stackexchange.com/questions/82112/stereo-tone-generator-for-linux/536860#536860
- stackoverflow.com/questions/5109038/linux-sine-wave-audio-generator/57610684#57610684
- superuser.com/questions/724391/how-to-generate-a-sine-wave-with-ffmpeg
- stackoverflow.com/questions/59551013/how-to-generate-stereo-sine-wave-using-ffmpeg-with-different-frequencies-for-eac/77730492#77730492
Video with a solid color:
- 2 second white video:Also add some audio:
ffplay -autoexit -f lavfi -i 'color=white:640x480:d=3,format=rgb24,trim=end=2'TODO how to ffplay the video + audio directly?ffmpeg -lavfi "color=white:640x480:d=3,format=rgb24,trim=end=2[v];sine=f=1000:d=2[a]" -map '[a]' -map '[v]' out.mkv-mapdoes not seem to work unfortunately. - 2 second white followed by 2 second black video:
ffplay -autoexit -f lavfi -i 'color=white:640x480:d=3,format=rgb24,trim=end=2[a];color=black:640x480:d=3,format=rgb24,trim=end=2[b];[a][b]concat=n=2:v=1:a=0' - bibliography:
Display count in seconds on the video:
- black text on white background. Start from 0 and count up to 2:
ffplay -autoexit -f lavfi -i " color=white:480x480:d=3, format=rgb24, drawtext= fontcolor=black: fontsize=600: text='%{eif\:t\:d}': x=(w-text_w)/2: y=(h-text_h)/2 " - count 0 to 2 with one different sine wave per count:
ffmpeg -lavfi " color=white:480x480:d=3, format=rgb24, drawtext= fontcolor=black: fontsize=600: text='%{eif\:t\:d}': x=(w-text_w)/2: y=(h-text_h)/2[v]; sine=f=500:d=1[a1]; sine=f=1000:d=1[a2]; sine=f=2000:d=1[a3]; [a1][a2][a3]concat=n=3:v=0:a=1[a]; " -map '[v]' -map '[a]' count.mkv - bibliography:
Bibliography:
- ffmpeg.org//ffmpeg-filters.html#Video-Sources main section of the documentation listing various video generators
- stackoverflow.com/questions/11640458/how-can-i-generate-a-video-file-directly-from-an-ffmpeg-filter-with-no-actual-in generically asking how to generate the video without an input video
FFmpeg is likely the backend of YouTube through reverse engineering: streaminglearningcenter.com/blogs/youtube-uses-ffmpeg-for-encoding.html (archive)
This is a really good one to quickly browser multiple images present in a directory, and also to do some basic editing on them!
At around 2022 development by the original devs faltered a bit but some other people seem to have picked it up:
convert -size 512x512 xc:blue blue.pngconvert -size 256x256 gradient: out.png
convert -size 256x256 gradient:white-black out.png
convert -size 256x256 gradient:red-blue out.png
convert -size 256x256 radial-gradient: out.png
convert -size 256x256 radial-gradient:white-black out.png Articles by others on the same topic
There are currently no matching articles.