screen recording per command line, i.e. bash-script
Posted: 21 Feb 2016 20:41
Hi guys,
I'm trying to start the screen recording feature of VLC media player using the command line under MacOS X (10.11.3, El Capitan) using a bash-script. I have accomplished this using the Windows version of VLC media player (2.0.8) and I'm now trying with VLC media player (2.2.2) under MacOSX. I'm using the following bash-script and it works, but not as I wanted/intend to do. Here is my script:
The variable
, doesn't matter which one, above is the line I believe is not working as I expect it. As in the Windows version I would expect that the remote control interface under MacOSX would start listening on host 127.0.0.1 port 81 and if I telnet to that host and port I could send the command which will stop the screen recording. Here is the command line output after executing my script:
The output file is created and the screen recording begins. But the only way to stop it is by pressing When I do that I get the following output added to the one above:
The output file is a correct recording of the screen. My problem is that this way I cannot use scripts to stop the recording when unattended, e.g. overnight integrated tests, etc.
Does anyone know how to set up the remote control under MacOSX for the command line so I can telnet to it to control it? Any help will be greatly appreciated.
Best regards,
I'm trying to start the screen recording feature of VLC media player using the command line under MacOS X (10.11.3, El Capitan) using a bash-script. I have accomplished this using the Windows version of VLC media player (2.0.8) and I'm now trying with VLC media player (2.2.2) under MacOSX. I'm using the following bash-script and it works, but not as I wanted/intend to do. Here is my script:
Code: Select all
#!/bin/bash
#Filename parameters
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
EXT="mp4"
# Screen parameters
#screen 1 1280 800
#screen 2 1600x1200
SCREENINDEX="1"
SCREENWIDTH="1280"
SCREENHEIGHT="800"
SCREENTOP="0"
SCREENLEFT="0"
# Transcode parameters
TRANSCODEVENC="x264"
TRANSCODEVCODEC="h264"
TRANSCODESCALE="1"
TRANSCODEFPS="25"
TRANSCODEVB="1024"
# Standard parameters
STANDARDACCESS="file"
STANDARDMUX="mp4"
STANDARDFILENAME="vlc-record-$TIMESTAMP-screen__""$SCREENWIDTH""x""$SCREENHEIGHT""_$TRANSCODEFPS""fps_$TRANSCODEVB""kb.$EXT"
STANDARDPATH="/Users/rohuezo/Movies/vlc-output/$STANDARDFILENAME"
# Command parameters
VLCEXE="/Applications/VLC.app/Contents/MacOS/VLC"
VLCDEVICE="screen://"
#VLCINTF="-I dummy $@"
VLCINTF="-I rc $@ --telnet-host 127.0.0.1 --telnet-port 81"
VLCDEFAULTS=""
VLCSCREEN="--screen-index $SCREENINDEX --screen-width $SCREENWIDTH --screen-height $SCREENHEIGHT --screen-top $SCREENTOP --screen-left $SCREENLEFT"
VLCSTANDARD=":standard{mux=$STANDARDMUX,access=$STANDARDACCESS{no-overwrite},dst=$STANDARDPATH}"
VLCTRANSCODE=":sout=#transcode{vcodec=$TRANSCODEVCODEC,vb=$TRANSCODEVB,scale=$TRANSCODESCALE,fps=$TRANSCODEFPS,acodec=none}"
VLCCOMMAND="$VLCEXE $VLCDEVICE $VLCINTF $VLCDEFAULTS $VLCSCREEN $VLCTRANSCODE$VLCSTANDARD"
echo "Calling: $VLCCOMMAND"
exec $VLCCOMMAND
Code: Select all
#VLCINTF="-I dummy $@"
VLCINTF="-I rc $@ --telnet-host 127.0.0.1 --telnet-port 81"
, doesn't matter which one, above is the line I believe is not working as I expect it. As in the Windows version I would expect that the remote control interface under MacOSX would start listening on host 127.0.0.1 port 81 and if I telnet to that host and port I could send the
Code: Select all
quit
Code: Select all
MacBookPro13:ScreenRecordingScripts rohuezo$ ./ScreenRecording.sh
Calling: /Applications/VLC.app/Contents/MacOS/VLC screen:// -I rc --telnet-host 127.0.0.1 --telnet-port 81 --screen-index 1 --screen-width 1280 --screen-height 800 --screen-top 0 --screen-left 0 :sout=#transcode{vcodec=h264,vb=1024,scale=1,fps=25,acodec=none}:standard{mux=mp4,access=file{no-overwrite},dst=/Users/rohuezo/Movies/vlc-output/vlc-record-20160221-203010-screen__1280x800_25fps_1024kb.mp4}
VLC media player 2.2.2 Weatherwax (revision 2.2.2-3-gf8c9253)
[0000000100604218] core interface error: no suitable interface module
[000000010022cf78] core libvlc error: interface "oldrc,none" initialization failed
[00000001006041e8] core interface error: no suitable interface module
[000000010022cf78] core libvlc error: interface "(null),none" initialization failed
[0000000100708ca8] [cli] lua interface: Listening on host "*console".
VLC media player 2.2.2 Weatherwax
Command Line Interface initialized. Type `help' for help.
> [00000001008758b8] x264 encoder: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[00000001008758b8] x264 encoder: profile High, level 3.2
[00000001008758b8] x264 encoder: final ratefactor: 28,61
[00000001006051e8] stream_out_transcode stream out: input interval 100000 (base 1)
[00000001006051e8] stream_out_transcode stream out: output interval 40000 (base 1)
[00000001008758b8] x264 encoder: using SAR=1/1
[00000001008758b8] x264 encoder: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[00000001008758b8] x264 encoder: profile High, level 3.2
Code: Select all
Ctrl-C
Code: Select all
^C[0000000100708ca8] [cli] lua interface error: Error loading script /Applications/VLC.app/Contents/MacOS/share/lua/intf/cli.luac: ...kage/macosx/../../../share/lua/intf/modules/host.lua:279: Interrupted.
[00000001008758b8] x264 encoder: frame I:3 Avg QP:16,31 size:253710
[00000001008758b8] x264 encoder: frame P:162 Avg QP:16,61 size: 6617
[00000001008758b8] x264 encoder: frame B:453 Avg QP:15,10 size: 216
[00000001008758b8] x264 encoder: consecutive B-frames: 1,8% 1,3% 0,5% 96,4%
[00000001008758b8] x264 encoder: mb I I16..4: 35,0% 10,8% 54,2%
[00000001008758b8] x264 encoder: mb P I16..4: 0,7% 0,4% 0,8% P16..4: 6,6% 0,6% 0,5% 0,0% 0,0% skip:90,4%
[00000001008758b8] x264 encoder: mb B I16..4: 0,1% 0,1% 0,0% B16..8: 3,6% 0,0% 0,0% direct: 0,0% skip:96,2% L0:31,7% L1:68,2% BI: 0,1%
[00000001008758b8] x264 encoder: final ratefactor: 16,94
[00000001008758b8] x264 encoder: 8x8 transform intra:17,8% inter:48,7%
[00000001008758b8] x264 encoder: coded y,uvDC,uvAC intra: 35,6% 46,5% 41,2% inter: 0,7% 1,3% 0,8%
[00000001008758b8] x264 encoder: i16 v,h,dc,p: 48% 47% 4% 0%
[00000001008758b8] x264 encoder: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 46% 1% 1% 1% 2% 0% 2%
[00000001008758b8] x264 encoder: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 30% 12% 2% 5% 4% 7% 3% 5%
[00000001008758b8] x264 encoder: i8c dc,h,v,p: 49% 37% 12% 2%
[00000001008758b8] x264 encoder: Weighted P-Frames: Y:0,0% UV:0,0%
[00000001008758b8] x264 encoder: ref P L0: 87,9% 3,5% 7,1% 1,5%
[00000001008758b8] x264 encoder: ref B L0: 44,9% 54,3% 0,8%
[00000001008758b8] x264 encoder: ref B L1: 96,8% 3,2%
[00000001008758b8] x264 encoder: kb/s:624,85
MacBookPro13:ScreenRecordingScripts rohuezo$
Does anyone know how to set up the remote control under MacOSX for the command line so I can telnet to it to control it? Any help will be greatly appreciated.
Best regards,