Run command after player stops

Got an idea? Missing something? Post your feature request here.

Moderator: moderators

Run command after player stops

Postby astalec » Wed Dec 21, 2011 5:14 pm

Hello,

I am trying to get VLC transcoding to work. By calling it through vlc.exe, it exits correctly after playback stops.
But, to be able to customize some settings, I need to call the executable through a batch file, called vlc-cmd.bat
The problem is that I am unable to catch the stop call from within the batch and then ask vlc executable to stop. vlc continues to run, eating cpu time.
Also, a new vlc.exe process is spawned every time a new clip is opened without closing the existing ones.
I tried to debug using the batch file, any line after vlc.exe is never executed.

I was able to workaround this issue by calling taskkill.exe before starting vlc.exe, but there is one thing left to do, stopping the vlc.exe process after all playback is stopped.

If you could guide me what trigger can I use to find out if the player is actually playing or not it would be very nice. Or better, where in the application the actual command is called and if its possible to run a custom command when playback finishes.

This is my script, I am calling it from subsonic with vlc-cmd.bat %s %b

@ECHO OFF
setlocal enableextensions enabledelayedexpansion
taskkill.exe /f /im vlc.exe
rem Determine if the input is a stream
FOR /F "tokens=*" %%A IN ('dir /b %1 ^| find /c ".webstream.ts"') DO SET /A isStream=%%A
IF %isStream% EQU 1 (
FOR /F "tokens=*" %%A IN ('type %1') DO SET source=%%A
) else (
set source=%1
)
SET /A bitRate=%2
IF %bitRate% LEQ 200 (
SET /A audioBitrate=32
SET /A audioChannels=1
SET /A audioSampling=22050
)
IF %bitRate% GTR 200 IF %bitRate% LEQ 512 (
SET /A audioBitrate=64
SET /A audioChannels=1
SET /A audioSampling=44100
) else (
SET /A audioBitrate=128
SET /A audioChannels=2
SET /A audioSampling=44100
)
SET /A videoBitrate=%bitRate%-%audioBitrate%
SET videoScale=0.5
c:\subsonic\transcode\vlc.exe -I dummy --dummy-quiet %source% :sout=#transcode{venc=x264{profile=baseline,level=3,keyint=50,bframes=0,no-cabac,ref=1,no-interlaced,vbv-maxrate=%videoBitrate%,vbv-bufsize=512,aq-mode=0,no-mbtree,partitions=none,no-weightb,weightp=0,me=umh,subme=0,no-mixed-refs,no-8x8dct,trellis=0},vcodec=h264,scale=%videoScale%,aenc=ffmpeg{aac-profile=low},acodec=mp4a,ab=%audioBitrate%,channels=%audioChannels%,samplerate=%audioSampling%,audio-sync,scodec=dvbs,soverlay}:standard{access=file,mux=ffmpeg{mux=flv},dst=-}vlc://quit
astalec
 
Posts: 2
Joined: Thu Dec 15, 2011 10:11 pm

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 7 guests