M. Eerie wrote: ↑07 Jun 2023, 11:24
Code: Select all
ffmpeg -video_size 1280x800 -framerate 25 -f x11grab -i :0.0+50,30 input.mp4
This command, and the full screen capture as well, will record everything on the desktop and
run forever.
You will have to stop it by using Ctrl+C.
The downside: it will also record the terminal you started the above command with. And this is probably not what you want to record to begin with.
You can avoid that by using a sleep command at the beginning, maybe with a command that plays a sound between the sleep and the ffmpeg recording (to signal you when the recording starts). And start all these on another desktop, and during the sleep switch to a different desktop. But you will still have to switch back to the desktop you started the commands to stop the recording via Ctrl+C. And then you have the witching back to the other desktop also recorded, and again this is something you do not want.
Example: Sleep 5 seconds.
the "beep" command is a valid command that plays a sound. (you have to either code this command to suit your local needs yourself, or use some mpg123 or mpv command playing some valid multimedia sound file. It should only be a sound file not containing any video)
and the ffmpeg command:
Code: Select all
sleep 5;beep;ffmpeg -video_size 1280x800 -framerate 25 -f x11grab -i :0.0+50,30 input.mp4
M. Eerie, do you know a way to tell ffmpeg to only record a certain time? Or to only record a certain amount of frames?
Because even when you use sleep like above, you still would have to switch back to the desktop you started my above example, and that will create video parts you not want in your resulting video.
The only solution would be, starting the ffmpeg command and also starting a command that waits a certain time and then sends the ffmpeg command the signal equivalent of Ctrl+C to interrupt the recording, but I am not sure how that can be implemented. (It could be done when you use a script that uses the ffmpeg command as above, but puts that into the background by adding
" &" (minus the quotes) at the end, then wait for the wanted seconds and send the signal to the ffmpeg command, but I am not sure if the ffmpeg screen recording command would work as intended when put it into the background?)
The only way using ffmpeg to record the screen and not also having the terminal that starts the ffmpeg command in it would be:
Use the upper left corner of the screen for the things you want to record.
Move the terminal that starts the cropped ffmpeg screen capture record to the lower right corner and (when needed) move it partially outside your visible screen.
Make sure the command is typed correctly when the terminal is fully visible but to not yet press enter.
Then move the terminal window outside the recorded area into the lower right corner and when needed even partially outside your visible screen.
Start the recording by pressing enter. (You can add the pause and sound playing command as well so that you can move the mouse to an area inside the recorded area prior the start of the recording)
During the recording do what you want to be recorded. When you want the recording to end, move the mouse cursor to the terminal, bring it into focus and press Ctrl+C.
Since the terminal sits outside your recorded area, this part will not be recorded. (You will have some unnecessary second(s) at the end of your resulting video file where seemingly nothing happens, though)