cytopia / ffscreencast

ffscreencast - ffmpeg screencast/desktop-recording with video overlay and multi monitor support
MIT License
1.77k stars 76 forks source link

How to change the dimensions of the overlay camera? #21

Closed oren closed 7 years ago

oren commented 7 years ago

Both commands record with the same dimensions so I am probably passing something wrong in the arguments:

ffscreencast -a1 -c --cargs="-video_size 320x180" --oargs='-c:a flac'
ffscreencast -a1 -c --cargs="-video_size 160x90" --oargs='-c:a flac'

Thanks!

cytopia commented 7 years ago

Could you add --dry to the command and paste the output back in here please.

oren commented 7 years ago
/usr/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f x11grab -video_size 1600x900  -i ":0.0" -thread_queue_size 512 -f v4l2  -video_size 320x180 -i "/dev/video0" -thread_queue_size 512 -f alsa -ac 2 -i "hw:0,0" -c:a libfaac -c:v libx264 -c:a flac -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 "/home/oren/Desktop/Screencast 2017-03-18 at 12.21.30.mkv"

And:

/usr/bin/ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -f x11grab -video_size 1600x900  -i ":0.0" -thread_queue_size 512 -f v4l2  -video_size 160x90 -i "/dev/video0" -thread_queue_size 512 -f alsa -ac 2 -i "hw:0,0" -c:a libfaac -c:v libx264 -c:a flac -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 "/home/oren/Desktop/Screencast 2017-03-18 at 12.21.39.mkv"
oren commented 7 years ago

it looks like the video_size was not changes.

cytopia commented 7 years ago

Could you enter the command manually and adjust the overlay=main_w-overlay_w-10:main_h-overlay_h-10 part to scale=1000:1000,overlay=main_w-overlay_w-10:main_h-overlay_h-10

Note the added scale=1000:1000,

oren commented 7 years ago

i did that and the recording's width got smaller.

cytopia commented 7 years ago

I am also not too sure about this command. Could you play around with it a bit. Maybe trying:

scale=100:100,

and

scale=10:10,
oren commented 7 years ago

thanks for your help. I tried it but it look pretty bad (:

cytopia commented 7 years ago

Did the camera overlay get bigger/smaller by adjusting these values?

Btw, what should be your expected result. How big do you want to have the camera overlay (1/4 of the screen or 1/8 ...)? I will play around and see to find a solution

oren commented 7 years ago

i want it to be a bit smaller. the recent experiment/command made it huge. i can't even describe what i saw (:

cytopia commented 7 years ago

Hi @oren

I got something to work.

ffmpeg -f alsa -i pulse -f x11grab -s 1600x900 -r 30 -i :0.0+0,0 -vf "movie=/dev/video0:f=video4linux2, scale=480:-1, fps, setpts=PTS-STARTPTS [movie]; [in][movie] overlay=main_w-overlay_w-2:main_h-overlay_h-2 [out]" -vcodec libx264 -crf 20 -preset veryfast -threads 0 ~/Desktop/video1.mkv

Please let me know how it works

oren commented 7 years ago

the size of the overlay camera changes as expected. but now I noticed two issues:

  1. the audio is behind the video (a second late).
  2. the video recording is cut off a second or two earlier
cytopia commented 7 years ago

Apart from the audio, Is the camera and the desktop recording in sync?

oren commented 7 years ago

yeah

cytopia commented 7 years ago

Please open up a separate issue for the audio problem so we can keep things organised I will close this ticket for now, as the camera problem is solvable (at least via raw ffmpeg commands).

Changing the camera size easily will be integrated in ffscreencast 2.0

oren commented 7 years ago

is there a plan to add your workaround for the video size issue into the API of ffscreencast? so i can do something like this:

ffscreencast -a1 -c --cargs="-video_size 160x90" --oargs='-c:a flac'