I figured out that you don't need to use a full-fledged video editor to apply some basic transition effects to video and audio.
Using FFmpeg, you can apply basic fade in and fade out to video using the fade filter. For audio, the afade filter can be used to achieve a similar effect.
ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=3" -c:a copy out.mp4
This will start the video with a black screen and fade into full view over 3 seconds.
ffmpeg -i video.mp4 -vf "fade=t=out:st=10:d=5" -c:a copy out.mp4
This will make the video start fading to black over 5 seconds at the 10-second mark.
ffmpeg -i music.mp3 -af "afade=t=in:st=0:d=5" out.mp3
The audio file will start at a low volume and fade in to full over 5 seconds.
ffmpeg -i music.mp3 -af "afade=t=out:st=5:d=5" out.mp3
The audio file will start fading to zero volume over 5 seconds starting at the 5-second mark.
ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=10,fade=t=out:st=10:d=5" -c:a copy out.mp4
You can apply both fade in and out effects at the same time, to avoid having to re-encode twice.
Did you find this information useful? If so, consider heading over to my donation page and drop me some support.
Want to ask a question or just chat? Contact me here