Posted: . At: 9:24 AM. This was 3 years ago. Post ID: 15254
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to properly brighten a video file with FFmpeg.


Making a video file brighter is very easy, this can be done with FFmpeg. The curves filter can easily brighten a video file without causing much degradation at all.

Use this example to make a video file a bit brighter and it will still be the same quality.

ffmpeg -i -i underground-war.mp4 -vf "curves=all='0/0 0.4/1 1/1'" -ss 00:36.00 -t 6.6 -c:v libvpx -b:v 3200k -an -sn -copyts -threads 4 ground.webm

This is the original dark video file.

And this is the video file after the process, it is a lot brighter, but you keep a lot of quality and it is not very grainy.

This long filter example will overlay one video over another in the top left corner, this requires two videos exactly the same length, but this does work very well.

ffmpeg -y -i zombiestrain.avi -i zombiestrainr.avi -filter_complex "[1:a] atrim=15:30,adelay=5000|5000 [a1]; \
 [0:a][a1] amix [outa]; [1:v] scale=320:-1,setpts=PTS-(10/TB) [1v]; [0:v][1v] overlay=x=25:y=25:[outv]" -map "[outv]" \
  -map "[outa]" -c:a aac -c:v libx264 -b:v 1000k -r 24 output.mp4

This final example shows how to overlay an image over a video. This is rather like Twitch videos with the fancy overlay.

┌──[jason@192.168.1.2][~/Videos]
└──╼  ╼ $ ffmpeg -i zombiestrain.avi -i BFBC2_M1A2_HUD.png -filter_complex "[0:v][1:v] overlay=0:0:" -pix_fmt yuv420p -c:a copy output.avi

Make sure the video and the overlay image are the same resolutions.

The FFmpeg user may also use Chrome Keying and blend one video over another.

┌──[jason@192.168.1.2][~/Videos/titles]
└──╼  ╼ $ ffmpeg -i 1626763750752.webm -i 1626763498662.webm -filter_complex '[1:v]colorkey=0x2e693e:0.3:0.2[ckout];[0:v][ckout]overlay[out]' -map '[out]' blend.webm

The first file is the background video, and the second is the overlay with the colours you wish to make transparent. Take a screenshot in the Gimp and then use the eyedropper tool to sample the colour you wish to be transparent, e.g green.

The colorkey=0x2e693e value is the hexadecimal colour value that will be transparent. The 0.3:0.2 values are the tolerance on the color blending and how gradual it is respectively.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.