I provide courses as https://en.wikipedia.org/wiki/Flipped_classroom which means I provide lectures on video. This page here is to keep a current state of the tools and configurations I use — for me and for others to take a (bad or good) example.
Disclaimer: I am not a video producer and even less a nerd-of-video-production. I am focussing more on volume and consistency of content and want to be my video-production process to be lean and fast.
Format
Final Output Format:
- MP4-Container
- Video: h264, 1280x720, 16:9, 30 fps
- Audio: mp3, 48000 Hz, stereo
I admit, that the choice of format is mostly determined by the default configuration I found in flowblade. I solely reduced the output resolution until my students stopped arguing about large file-size and before the could start arguing about the video resolution. It is — obviously — best to directly record the same or a comparable format to your intended output.
Matroska Format
I would like very much to publish my videos in Matroska format and will in the future switch from MP4, but at the beginning, there have been students who where unable to decode Matroska, so I changed my production chain for the time being.
Tools
- OBS Studio providing “scenes”, recording and streaming
- Shotcut video editing software, alledgedly very easy to use
- Flowblade video editing
- there are simpler tools, but has been the first I found and I manage to assemble and cut video-snippets in here
- will be rendered, which takes a lot of time, probably there is a copy-renderer inside
- ffmpeg used for the fastest way to re-package
or recode videos as a batch job. Loop over all files that have to be
converted and the computer does the rest.
- Active use: re-package from https://de.wikipedia.org/wiki/Matroska to MP4, as not all students have been able to watch videos in Matroska.
Video editing with ffmpeg
Re-packaging a batch of videos from mkv to mp4. Videos have to be correctly ordered, will then be numbered in that order and renamed in subdirectory mp4:
i=1; for f in *.mkv; do ffmpeg -i $f -codec copy mp4/mathe2-02-$(printf "%02d" $i).mp4; i=$((i+1)) ; done
Concatenation of Videos
First write a file inputs.txt with all the paths to videos to be concatenated prepended by “file”:
# Comment in line with Hash
file `first_video.mkv`
file `second_video.mkv`
file `as_many_as_you_like.mkv`
And then apply:
ffmpeg -f concat -safe 0 -i inputs.txt -c copy new_file.mp4
Flag safe set to 0 to accept any filename, see ffmpeg concat options. As codec copy is used, all input videos should already have the same video- and audio-stream formats. Otherwise you need to specifiy the mapping explicitly.
Greenscreen with ffmpeg
I did not fully succeed in creating a nice video with swapped background for two reasons: bad lighting and wrong colour-filter used. But the following should enable you to start with your own experiments more quickly.
Creating a Video Loopback
Install Video4Linux Loopback from v4l2 loopback if you do not find it in your packet manager.
Ensure module is loaded to create a loopback device:
sudo modprobe v4l2loopback
or creating 4 devices if you need more:
sudo modprobe v4l2loopback devices=4
Get available cameras
v4l2-ctl --list-devices
Create named pipe
(to pipe a video through it)
mkfifo /tmp/vfifo
Create Overlay with “Whitefilter” and pipe it into named pipe
Experiments to finally filter a greenscreen. I used the colorkey-filter. Nowadays I would try the chromakey-filter, which works in the YUV colorspace and thus ignores the luminisence of the colour value. This should improve the greenscreen filter greatly.
Filters the colour white from /dev/video2 and inserts the image image.jpg as background.
Output to a fifo:
ffmpeg -f v4l2 -video_size 800x600 -i /dev/video2 -i image.jpg -filter_complex "[0:v]colorkey=white:0.35:0.0[ckout];[1:v]scale=800:600[olout];[olout][ckout]overlay[out]" -map "[out]" -f mpegts - >> /tmp/vfifo
or to a video loopback:
ffmpeg -f v4l2 -video_size 800x600 -i /dev/video1 -i share/img/unsplash/mark-harrison-rooftop_hacker-unsplash-full.jpg -filter_complex "[0:v]colorkey=white:0.35:0.0[ckout];[1:v]scale=800:600[olout];[olout][ckout]overlay[out]" -map "[out]" -f v4l2 /dev/video2
Instead of an image, you could also loop a video in the background:
ffmpeg -f v4l2 -video_size 800x600 -i /dev/video0 -i Universe_Fury.mp4 -filter_complex "[0:v]colorkey=white:0.7:0.0[ckout];[1:v]loop=-1[loop];[loop]scale=800:600[olout];[olout][ckout]overlay[out];[out]crop=800:600:0:0[crop];[crop]format=yuv420p[enc]" -map "[enc]" -f v4l2 /dev/video2
Play with mplayer from named pipe
cat /tmp/vfifo | mplayer -cache 1024 -