How to record video and sound from a game with command line

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
Bronson
New Cone
New Cone
Posts: 3
Joined: 19 Aug 2019 20:03

How to record video and sound from a game with command line

Postby Bronson » 19 Aug 2019 20:12

Hi!
I made a command for the batch file to record desktop screen. Everything works fine except that I cannot record sound in any way. I manage to do this with GUI, but I have to use the command line. Any help will be appreciated.
This is the script that I made, it uses a timestamp to name a file and it works in the background.

Code: Select all

ECHO. SET Timestamp=%date:~6,8%-%date:~3,2%-%date:~0,2%_%time:~0,2%:%time:~3,2%:%time:~6,2% ECHO %Timestamp% SET Timestamp=%date:~6,8%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% call %CD%\VLC\vlc.exe ^ screen:// --one-instance ^ -I null --play-and-exit ^ --udp-caching=500 --tcp-caching=500 --realrtsp-caching=500 ^ --extraintf rc ^ --rc-host localhost:8088 ^ --rc-quiet ^ --no-skip-frames ^ --no-video :screen-fps=30 :screen-caching=100 :screen-left=0 :screen-width=1920 :screen-height=1080^ --sout-x264-preset ultrafast ^ "#transcode{vcodec=h264,acodec=mp4a,ab=96,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=mp4,dst='../../../../../Recordings/%Timestamp%.mp4'}}"

Rémi Denis-Courmont
Developer
Developer
Posts: 15133
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to record video and sound from a game with command line

Postby Rémi Denis-Courmont » 19 Aug 2019 20:50

In principles:
vlc screen:// --input-slave wasapi:// --wasapi-loopback ...
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Bronson
New Cone
New Cone
Posts: 3
Joined: 19 Aug 2019 20:03

Re: How to record video and sound from a game with command line

Postby Bronson » 20 Aug 2019 11:04

Dear Rémi,

Thank you for your answer. If you could help me a little more because I cannot use this command in my script. When I'm trying to use it like this, I'm getting an error "VLC media player could not start. Either the command line options where invalid or no plugins where find". I have VLC 3.0.7.1.

Code: Select all

call %CD%\VLC\vlc.exe ^ screen:// --input-save wasapi:// --wasapi-loopback^ -I null --play-and-exit ^ --udp-caching=500 --tcp-caching=500 --realrtsp-caching=500 ^ --extraintf rc ^ --rc-host localhost:8088 ^ --rc-quiet ^ --no-skip-frames ^ --no-video :screen-fps=30 :screen-caching=100 :screen-left=0 :screen-width=1920 :screen-height=1080^ --sout-x264-preset ultrafast ^ --sout "#transcode{vcodec=h264,acodec=mp4a,ab=96,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=mp4,dst='d:\VLCTEST\Test.mp4'}}"

Rémi Denis-Courmont
Developer
Developer
Posts: 15133
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to record video and sound from a game with command line

Postby Rémi Denis-Courmont » 20 Aug 2019 18:47

slave
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Bronson
New Cone
New Cone
Posts: 3
Joined: 19 Aug 2019 20:03

Re: How to record video and sound from a game with command line

Postby Bronson » 21 Aug 2019 13:13

Dear Remi,

my typo was really embarrassing. Thank you for your patience. The command lines look like below but still, vlc don't receive any sound. I was trying to get sound from any device from the sound manager but with no luck. The same with changing sound devices.

Do you have any more tips? Thank you for help anyway.

Code: Select all

call %CD%\VLC\vlc.exe ^ screen:// --input-slave wasapi:// --wasapi-loopback^ -I null --play-and-exit ^ --udp-caching=500 --tcp-caching=500 --realrtsp-caching=500 ^ --extraintf rc ^ --rc-host localhost:8088 ^ --rc-quiet ^ --no-skip-frames ^ --no-video :screen-fps=30 :screen-caching=100 :screen-left=0 :screen-width=1920 :screen-height=1080^ --sout-x264-preset ultrafast ^ --sout "#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=mp4,dst='D:/VLCTest/Test.mp4'}}"

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: How to record video and sound from a game with command line

Postby unidan » 19 Sep 2019 20:27

Hi, do you have the log related to this command line ?

behasywu
New Cone
New Cone
Posts: 1
Joined: 07 Dec 2019 10:39

Re: How to record video and sound from a game with command line

Postby behasywu » 07 Dec 2019 11:14

Hi, I'm trying to get something similar working, but only need audio. What I have is:

Code: Select all

vlc.exe wasapi:// --wasapi-loopback --sout "#transcode{vcodec=none,acodec=vorb,ab=128,channels=2,samplerate=44100,scodec=none}:std{access=http,dst=:8080,mux=ts }" --no-sout-all --sout-keep

Only have this in log:

Code: Select all

[0000015c63f49c30] wasapi demux error: cannot get capture client (error 0x88890003)

0x88890003 apparently means AUDCLNT_E_WRONG_ENDPOINT_TYPE: The AUDCLNT_STREAMFLAGS_LOOPBACK flag is set but the endpoint device is a capture device, not a rendering device.

Due to https://stackoverflow.com/a/24569799, I'm unsure if this is even supposed to work.

Am I missing an option to capture loopback correctly?

VLC: 3.0.7.1, 3.0.8
Windows: 10 1903


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 14 guests