1

Running vlc player from a windows bat-file, I want to play several fragmentes from one and the same video file.

Up to now, I have this (just for demonstration purpose: playing video_file.mp4 from 0:15 to 0:17, then 0:45 to 0:48):

"C:[path]vlc.exe" video_file.mp4 --start-time 15 --stop-time 17 --fullscreen --video-title-timeout=0  --play-and-exit

"C:[path]vlc.exe" video_file.mp4 --start-time 45 --stop-time 48 --fullscreen --video-title-timeout=0  --play-and-exit

After each fragment, the player stops with the last frame. I have to close vlc player and it reopens automatically to play the next sequence.

However, I would like it to immediately start the next sequence: how to do that?

I tried adding the timecodes for the second sequence immediately after the first one, but that does not work. Alos deleting --play-and-exit or replacing it with --play-and-pause stops the playback.

2
  • Did you tried this before ? Do You Want VLC to Restart or Continue the Playback Where Left Off?
    – Hackoo
    Commented Sep 27, 2022 at 2:33
  • Thanks, I tried that, but it's not what I want. THis options allows to stop the video and later resume at the same time. I would like not to stop the video and not to resume at the same time, but "jump" immediately to another timecode - like playback 20 seconds here, then immediately jump 3 minutes and play another 10 seconds from there etc.
    – Babel
    Commented Sep 27, 2022 at 8:18

1 Answer 1

2

Just give a try for this batch script and tell how does it works on your side ?


@echo off
set "VLCPathEXE=C:\Program Files\VideoLAN\VLC\vlc.exe"
set "videofile=video_file.mp4"
Call :PlayVideo "%videofile%" 20 30
Call :PlayVideo "%videofile%" 45 60
EXIT
::=================================================================================================================================================
:PlayVideo <VideoFile> <StartTime> <EndTime> <Duration to be Set>
set videofile=%~1
set /a "StartTime=%2"
Set /a "EndTime=%3"
echo STartTime : %StartTime%
echo EndTime   : %EndTime%
Set /a Duration=%EndTime% - %StartTime%+1
Start "" "%VLCPathEXE%" "%videofile%" --start-time %StartTime% --stop-time %EndTime% --fullscreen --video-title-timeout=0 --one-instance vlc://quit
Timeout /T %Duration% /Nobreak>nul & Taskkill /im "vlc.exe" /F
Exit /B
::=================================================================================================================================================
6
  • Unfortunately, the path to vlc is not found, so it does not run. could not find out how to change the script to include the path: C:\Program Files\VideoLAN\VLC\vlc.exe
    – Babel
    Commented Sep 27, 2022 at 9:42
  • OK, now, changing do Set "VLCPathEXE=%%j" with do Set "VLCPathEXE=C:\Program Files\VideoLAN\VLC\vlc.exe", it works - however, I have to add (copy) another line Timeout /T 3 /Nobreak>nul & taskkill /im "vlc.exe" /F at the end, otherwise VLC keeps playing the last sequence in loop. So this now comes close to what I was looking for, thanks! Only thing remains that VLC closes to be re-opened immediately to play the next sequence. Would be nice if it would contu^inue to play in the same instance/window, without closing/reopening a new window.
    – Babel
    Commented Sep 27, 2022 at 10:19
  • What does the Timeout /T 3 part stand for? I see I have to adapt this if I change start- and end-time. It seems I must adapt this to the length of the sequence between start- and end-time, right? Can't it be automatically set to the length defined by start/end-time?
    – Babel
    Commented Sep 27, 2022 at 10:26
  • @Babel yep your best is to define the start and end time and calculate the Duration= EndTime-StartTime and set it to Timeout
    – Hackoo
    Commented Sep 27, 2022 at 10:31
  • @Babel Please check my last edit.
    – Hackoo
    Commented Sep 27, 2022 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .