Page 1 of 1

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

Posted: 19 Aug 2019 20:12
by Bronson
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'}}"

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

Posted: 19 Aug 2019 20:50
by Rémi Denis-Courmont
In principles:
vlc screen:// --input-slave wasapi:// --wasapi-loopback ...

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

Posted: 20 Aug 2019 11:04
by Bronson
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'}}"

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

Posted: 20 Aug 2019 18:47
by Rémi Denis-Courmont
slave

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

Posted: 21 Aug 2019 13:13
by Bronson
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'}}"

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

Posted: 19 Sep 2019 20:27
by unidan
Hi, do you have the log related to this command line ?

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

Posted: 07 Dec 2019 11:14
by behasywu
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