How to Start FFMpeg Screen Recording with Custom Shortcut

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
4
down vote

favorite














What is the easiest way to run a FFMpeg screen recording command with a custom keyboard shortcut? Adding my raw ffmpeg command to a Custom Shortcut in the Keyboard settings doesn't do the trick.



Here's the command I'm using:



ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv


The command works fine in terminal. It runs until you terminate it and outputs the file as expected, and running it as a keystroke doesn't appear to do anything, at least visibly. Also, running



gnome-terminal -e "ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv"


does open up a terminal window and run a function for a split second, but then the window closes again immediately. Adding "; bash" to the end of the string doesn't keep the window open. Managed to get a screenshot of the terminal window right before it closes, it seems to be terminating mid-execution of the function without displaying any errors. Here that is:



ffmpeg terminal window before termination



I'm running Ubuntu 16.04.3 LTS.










share|improve this question



















  • 1




    Hi dessert, thanks for the reply. Edited question accordingly.
    – BTEVC
    Feb 20 at 9:05






  • 1




    Updated with release description.
    – BTEVC
    Feb 20 at 23:07










  • Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
    – LordNeckbeard
    Feb 21 at 19:45














up vote
4
down vote

favorite














What is the easiest way to run a FFMpeg screen recording command with a custom keyboard shortcut? Adding my raw ffmpeg command to a Custom Shortcut in the Keyboard settings doesn't do the trick.



Here's the command I'm using:



ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv


The command works fine in terminal. It runs until you terminate it and outputs the file as expected, and running it as a keystroke doesn't appear to do anything, at least visibly. Also, running



gnome-terminal -e "ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv"


does open up a terminal window and run a function for a split second, but then the window closes again immediately. Adding "; bash" to the end of the string doesn't keep the window open. Managed to get a screenshot of the terminal window right before it closes, it seems to be terminating mid-execution of the function without displaying any errors. Here that is:



ffmpeg terminal window before termination



I'm running Ubuntu 16.04.3 LTS.










share|improve this question



















  • 1




    Hi dessert, thanks for the reply. Edited question accordingly.
    – BTEVC
    Feb 20 at 9:05






  • 1




    Updated with release description.
    – BTEVC
    Feb 20 at 23:07










  • Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
    – LordNeckbeard
    Feb 21 at 19:45












up vote
4
down vote

favorite









up vote
4
down vote

favorite













What is the easiest way to run a FFMpeg screen recording command with a custom keyboard shortcut? Adding my raw ffmpeg command to a Custom Shortcut in the Keyboard settings doesn't do the trick.



Here's the command I'm using:



ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv


The command works fine in terminal. It runs until you terminate it and outputs the file as expected, and running it as a keystroke doesn't appear to do anything, at least visibly. Also, running



gnome-terminal -e "ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv"


does open up a terminal window and run a function for a split second, but then the window closes again immediately. Adding "; bash" to the end of the string doesn't keep the window open. Managed to get a screenshot of the terminal window right before it closes, it seems to be terminating mid-execution of the function without displaying any errors. Here that is:



ffmpeg terminal window before termination



I'm running Ubuntu 16.04.3 LTS.










share|improve this question

















What is the easiest way to run a FFMpeg screen recording command with a custom keyboard shortcut? Adding my raw ffmpeg command to a Custom Shortcut in the Keyboard settings doesn't do the trick.



Here's the command I'm using:



ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv


The command works fine in terminal. It runs until you terminate it and outputs the file as expected, and running it as a keystroke doesn't appear to do anything, at least visibly. Also, running



gnome-terminal -e "ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv"


does open up a terminal window and run a function for a split second, but then the window closes again immediately. Adding "; bash" to the end of the string doesn't keep the window open. Managed to get a screenshot of the terminal window right before it closes, it seems to be terminating mid-execution of the function without displaying any errors. Here that is:



ffmpeg terminal window before termination



I'm running Ubuntu 16.04.3 LTS.







command-line shortcut-keys ffmpeg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 20 at 23:06

























asked Feb 20 at 3:58









BTEVC

214




214







  • 1




    Hi dessert, thanks for the reply. Edited question accordingly.
    – BTEVC
    Feb 20 at 9:05






  • 1




    Updated with release description.
    – BTEVC
    Feb 20 at 23:07










  • Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
    – LordNeckbeard
    Feb 21 at 19:45












  • 1




    Hi dessert, thanks for the reply. Edited question accordingly.
    – BTEVC
    Feb 20 at 9:05






  • 1




    Updated with release description.
    – BTEVC
    Feb 20 at 23:07










  • Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
    – LordNeckbeard
    Feb 21 at 19:45







1




1




Hi dessert, thanks for the reply. Edited question accordingly.
– BTEVC
Feb 20 at 9:05




Hi dessert, thanks for the reply. Edited question accordingly.
– BTEVC
Feb 20 at 9:05




1




1




Updated with release description.
– BTEVC
Feb 20 at 23:07




Updated with release description.
– BTEVC
Feb 20 at 23:07












Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
– LordNeckbeard
Feb 21 at 19:45




Don't know anything about the shortcut component of the question, but ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 should be ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i :0.0. More info: x11grab docs.
– LordNeckbeard
Feb 21 at 19:45










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Found a solution. Running the command with "-x sh -c" as opposed to "-e" executes the function without exiting the window. Syntax borrowed from this superuser discussion.



The full function:



gnome-terminal -x sh -c 'ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv; exec bash'





share|improve this answer
















  • 1




    As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
    – LordNeckbeard
    Feb 22 at 18:47










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007896%2fhow-to-start-ffmpeg-screen-recording-with-custom-shortcut%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










Found a solution. Running the command with "-x sh -c" as opposed to "-e" executes the function without exiting the window. Syntax borrowed from this superuser discussion.



The full function:



gnome-terminal -x sh -c 'ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv; exec bash'





share|improve this answer
















  • 1




    As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
    – LordNeckbeard
    Feb 22 at 18:47














up vote
0
down vote



accepted










Found a solution. Running the command with "-x sh -c" as opposed to "-e" executes the function without exiting the window. Syntax borrowed from this superuser discussion.



The full function:



gnome-terminal -x sh -c 'ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv; exec bash'





share|improve this answer
















  • 1




    As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
    – LordNeckbeard
    Feb 22 at 18:47












up vote
0
down vote



accepted







up vote
0
down vote



accepted






Found a solution. Running the command with "-x sh -c" as opposed to "-e" executes the function without exiting the window. Syntax borrowed from this superuser discussion.



The full function:



gnome-terminal -x sh -c 'ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv; exec bash'





share|improve this answer












Found a solution. Running the command with "-x sh -c" as opposed to "-e" executes the function without exiting the window. Syntax borrowed from this superuser discussion.



The full function:



gnome-terminal -x sh -c 'ffmpeg -f x11grab -s 1366x768 -i :0.0 -r 25 -vcodec libx264 `date +%Y-%m-%d_%H-%M-%S`_BTEVCpcampFormBook.mkv; exec bash'






share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 22 at 3:13









BTEVC

214




214







  • 1




    As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
    – LordNeckbeard
    Feb 22 at 18:47












  • 1




    As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
    – LordNeckbeard
    Feb 22 at 18:47







1




1




As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
– LordNeckbeard
Feb 22 at 18:47




As I mentioned in the comment your -r is incorrect. By coincidence it won't make a difference as is since 25 is the default for x11grab, but if you change it to any other value it will have to perform a frame rate conversion from 25 to your -r value. To prevent that remove -r and replace it with -framerate, and move it so it is an input option (before the -i).
– LordNeckbeard
Feb 22 at 18:47

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007896%2fhow-to-start-ffmpeg-screen-recording-with-custom-shortcut%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491