record screen and internal audio with ffmpeg
Clash Royale CLAN TAG#URR8PPP
What is the ffmpeg command to record screen and internal audio (on Ubuntu 18.04)?
I'll omit the many things I tried that did not work and skip to the something close to what I am looking for;
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes).mkv"
ffmpeg -video_size "$V" -framerate 10 -f x11grab -i :0.0 -f pulse -ac 2 -i "$A" "$F"
I can get video but no audio.
parecord -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor example.wav # index: 1
will get audio.
ubuntu pulseaudio ffmpeg recording
add a comment |
What is the ffmpeg command to record screen and internal audio (on Ubuntu 18.04)?
I'll omit the many things I tried that did not work and skip to the something close to what I am looking for;
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes).mkv"
ffmpeg -video_size "$V" -framerate 10 -f x11grab -i :0.0 -f pulse -ac 2 -i "$A" "$F"
I can get video but no audio.
parecord -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor example.wav # index: 1
will get audio.
ubuntu pulseaudio ffmpeg recording
In principle, that looks good. If you can't get audio, first step is to verify you got the correct.monitor
source. soecho $A
, startpavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g.parecord
. Next step is to tryffmpeg
to record only audio.
– dirkt
Dec 15 at 10:36
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00
add a comment |
What is the ffmpeg command to record screen and internal audio (on Ubuntu 18.04)?
I'll omit the many things I tried that did not work and skip to the something close to what I am looking for;
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes).mkv"
ffmpeg -video_size "$V" -framerate 10 -f x11grab -i :0.0 -f pulse -ac 2 -i "$A" "$F"
I can get video but no audio.
parecord -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor example.wav # index: 1
will get audio.
ubuntu pulseaudio ffmpeg recording
What is the ffmpeg command to record screen and internal audio (on Ubuntu 18.04)?
I'll omit the many things I tried that did not work and skip to the something close to what I am looking for;
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes).mkv"
ffmpeg -video_size "$V" -framerate 10 -f x11grab -i :0.0 -f pulse -ac 2 -i "$A" "$F"
I can get video but no audio.
parecord -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor example.wav # index: 1
will get audio.
ubuntu pulseaudio ffmpeg recording
ubuntu pulseaudio ffmpeg recording
edited Dec 17 at 16:43
asked Dec 14 at 21:23
user1133275
2,824519
2,824519
In principle, that looks good. If you can't get audio, first step is to verify you got the correct.monitor
source. soecho $A
, startpavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g.parecord
. Next step is to tryffmpeg
to record only audio.
– dirkt
Dec 15 at 10:36
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00
add a comment |
In principle, that looks good. If you can't get audio, first step is to verify you got the correct.monitor
source. soecho $A
, startpavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g.parecord
. Next step is to tryffmpeg
to record only audio.
– dirkt
Dec 15 at 10:36
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00
In principle, that looks good. If you can't get audio, first step is to verify you got the correct
.monitor
source. so echo $A
, start pavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g. parecord
. Next step is to try ffmpeg
to record only audio.– dirkt
Dec 15 at 10:36
In principle, that looks good. If you can't get audio, first step is to verify you got the correct
.monitor
source. so echo $A
, start pavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g. parecord
. Next step is to try ffmpeg
to record only audio.– dirkt
Dec 15 at 10:36
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00
add a comment |
1 Answer
1
active
oldest
votes
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
where
#A=1
#F=2018121711440500.mkv
#V=2560x1440
ffmpeg
the tool-loglevel error
only print errors-video_size "$V"
resolution of your screen (or less if you only want a subsection recorded)-f x11grab
record the screen (screen recordings may not be possible on wayland?)-i :0.0
the X11 screen ID, (can also add +x,y for offset)-f pulse
the audio driver-i "$A"
the id of the audio stream-f pulse
the audio driver again (maybe not needed?)-i default
normally the system microphone-filter_complex amerge
merge the 2 audio streams-ac 2
convert the 4 audio channels to 2-preset veryfast
go light on video encoding to avoid stuttering"$F"
the output file
Remember that the parameter order matters,
and pavucontrol
can re-map audio only while ffmpeg is running.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488063%2frecord-screen-and-internal-audio-with-ffmpeg%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
where
#A=1
#F=2018121711440500.mkv
#V=2560x1440
ffmpeg
the tool-loglevel error
only print errors-video_size "$V"
resolution of your screen (or less if you only want a subsection recorded)-f x11grab
record the screen (screen recordings may not be possible on wayland?)-i :0.0
the X11 screen ID, (can also add +x,y for offset)-f pulse
the audio driver-i "$A"
the id of the audio stream-f pulse
the audio driver again (maybe not needed?)-i default
normally the system microphone-filter_complex amerge
merge the 2 audio streams-ac 2
convert the 4 audio channels to 2-preset veryfast
go light on video encoding to avoid stuttering"$F"
the output file
Remember that the parameter order matters,
and pavucontrol
can re-map audio only while ffmpeg is running.
add a comment |
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
where
#A=1
#F=2018121711440500.mkv
#V=2560x1440
ffmpeg
the tool-loglevel error
only print errors-video_size "$V"
resolution of your screen (or less if you only want a subsection recorded)-f x11grab
record the screen (screen recordings may not be possible on wayland?)-i :0.0
the X11 screen ID, (can also add +x,y for offset)-f pulse
the audio driver-i "$A"
the id of the audio stream-f pulse
the audio driver again (maybe not needed?)-i default
normally the system microphone-filter_complex amerge
merge the 2 audio streams-ac 2
convert the 4 audio channels to 2-preset veryfast
go light on video encoding to avoid stuttering"$F"
the output file
Remember that the parameter order matters,
and pavucontrol
can re-map audio only while ffmpeg is running.
add a comment |
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
where
#A=1
#F=2018121711440500.mkv
#V=2560x1440
ffmpeg
the tool-loglevel error
only print errors-video_size "$V"
resolution of your screen (or less if you only want a subsection recorded)-f x11grab
record the screen (screen recordings may not be possible on wayland?)-i :0.0
the X11 screen ID, (can also add +x,y for offset)-f pulse
the audio driver-i "$A"
the id of the audio stream-f pulse
the audio driver again (maybe not needed?)-i default
normally the system microphone-filter_complex amerge
merge the 2 audio streams-ac 2
convert the 4 audio channels to 2-preset veryfast
go light on video encoding to avoid stuttering"$F"
the output file
Remember that the parameter order matters,
and pavucontrol
can re-map audio only while ffmpeg is running.
Framerate applied to both streams, but since ffmpeg documentation examples are scattered I'll leave an answer here
A="$(pacmd list-sources | grep -PB 1 "analog.*monitor>" | head -n 1 | perl -pe 's/.* //g')"
F="$(date --iso-8601=minutes | perl -pe 's/[^0-9]+//g').mkv"
V="$(xdpyinfo | grep dimensions | perl -pe 's/.* ([0-9]+x[0-9]+) .*/$1/g')"
ffmpeg -loglevel error -video_size "$V" -f x11grab -i :0.0 -f pulse -i "$A" -f pulse -i default -filter_complex amerge -ac 2 -preset veryfast "$F"
where
#A=1
#F=2018121711440500.mkv
#V=2560x1440
ffmpeg
the tool-loglevel error
only print errors-video_size "$V"
resolution of your screen (or less if you only want a subsection recorded)-f x11grab
record the screen (screen recordings may not be possible on wayland?)-i :0.0
the X11 screen ID, (can also add +x,y for offset)-f pulse
the audio driver-i "$A"
the id of the audio stream-f pulse
the audio driver again (maybe not needed?)-i default
normally the system microphone-filter_complex amerge
merge the 2 audio streams-ac 2
convert the 4 audio channels to 2-preset veryfast
go light on video encoding to avoid stuttering"$F"
the output file
Remember that the parameter order matters,
and pavucontrol
can re-map audio only while ffmpeg is running.
edited Dec 17 at 16:54
answered Dec 17 at 16:43
user1133275
2,824519
2,824519
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488063%2frecord-screen-and-internal-audio-with-ffmpeg%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In principle, that looks good. If you can't get audio, first step is to verify you got the correct
.monitor
source. soecho $A
, startpavucontrol
, verify that the sink corresponding to it is the one that gets the sound. Next step is to verify that you can record from it with some other program, e.g.parecord
. Next step is to tryffmpeg
to record only audio.– dirkt
Dec 15 at 10:36
@dirkt thanks apparently I did break a ffmpeg principle but I got it working now :) .
– user1133275
Dec 17 at 17:00