I had initially used VLC to record the screen of computer using the following script:
/Applications/VLC.app/Contents/MacOS/VLC -I rc screen:// --sout-keep --screen-fps=7.0 --screen-index=0 --sout #transcode{vcodec=h264,vb=1500,width=1280,height=720,acodec=mp3,ab=128,channels=2,samplerate=44100}:file{dst=/Users/shashi/temp/vlctesting4.mp4,no-overwrite}
The audio codec parameters are redundant because I am only recording the screen. However, with these video parameters, I get a decent recording of the screen without a noticeable cpu usage as well as relatively low file size.
Now I have to achieve the same but using FFmpeg instead of VLC. I thought that should be possible because both use the same underlying library. However, no matter how much I try, FFmpeg recording takes more CPU and the resulting file takes up much more space than what VLC achieves.
A sample FFmpeg command I tried:
ffmpeg -hide_banner -f avfoundation -i "2:none" -r 10 -vf "scale=-1:720,setsar=sar=10/9" -c:v h264_videotoolbox -b:v 1250K -keyint_min 20 -bf 5 testing_ffmpeg.mp4
Both are using the h264 encoding but how is VLC more efficient by such a degree? In fact VLC does not even seem to use the HW acceleration for encoding.. ? But a 1 minute recording from VLC is around 1 MB with decent quality but to get similar quality from FFmpeg, the file size is around 7 MB...