Page 1 of 1

Batch for playing several videos from pre-defined time-code

Posted: 19 Dec 2017 23:06
by babel
I have several videos that I'd like to play one after the other, but not the whole videos, but onle an extract of each. After each extract, playback should stop (freeze the image) to be reactivated only after striking a key.
To be more clear, it could look like this:

play video1, from timecode 20 sec. to timecode 1:30, freeze screen at the frame shown at 1:30
when a key is stoken, than
play video2, from timecode 50 sec. to timecode 2:25, freeze screen at the frame shown at 2:25

And so on with several videos. How to do this with a batch? I managed to create a batch-file that almost does it, it looks like this:
"C:\Program Files\VideoLAN\VLC\vlc.exe" video1.mp4 --start-time 20 --stop-time 90 --play-and-pause
"C:\Program Files\VideoLAN\VLC\vlc.exe" video2.mp4 --start-time 50 --stop-time 145 --play-and-pause

Image freezes after video1 is played as I want it to, but than I have to manually close vlc (CTRL-Q) and than automatically, a new instance of vlc opens and plays video2 as desired. But I guess it should be possible to do that without exiting VLC. How to do that?

--play-and-exit is not a solution, as I want the frozen image of video1 on the screen as long as I need, no pre-defined time and no immediate playback of video2.

Re: Batch for playing several videos from pre-defined time-code

Posted: 14 Jan 2018 12:44
by babel
In the meantime, I found a solution that does exactely what I wanted to - I show here the way I did it, it might be useful for others. It's a batch, combined with a playlist. The batch starts VLC and loads the playlist, orders playback in fullscreen and tells VLC to play each item of the playlist and than pause ("freeze" the screen).
Batch looks like that:

"C:\Program Files\VideoLAN\VLC\vlc.exe" [MyPlaylist.m3u] --fullscreen --play-and-pause --video-title-timeout=0

Last setting (--video-title-timeout=0) is to supress the showing of the video-title (file-name) when the process is started - an unnecessary, even annoying feature, especially if you have additional subtitels.

Expression in [squared brackets] to be repaced with the respective playlist-filename or path, if the playlist-file is not in the same directory - use ..\ for relative links to go 1 hierarchy-level up, like ..\ ..\ ..\plalylists\private\MyPlaylist.m3u to to 3 steps up and select there folder playlists, inside of which there is a folder private, in which the Playlist itself is stored.

For the playlist, I used the m3u format. Playlists can be easily done in VLC. Just darag and drop your video-files to an open instance of VLC or first open the "Playlist" symbol-button on the main user interface, where you see the files already added and where you cand edit the order of the videos, add more videos or delete others. When done, use "Save Playlist to file" from the "Media"-menu. In the created file, you can add star- and stop-times manually.

The playlist itself looks like this:

#EXTM3U

#EXTVLCOPT:start-time=[x]
#EXTVLCOPT:stop-time=[y]
[video1.mp4]

#EXTVLCOPT:start-time=[x]
#EXTVLCOPT:stop-time=[y]
[video2.mp4]

etc.

Again, [squared brackets] have to be replaced with the relevant values, like start-time=60 stop-time=120 to play the relevant video's second mintue, thus from timecode 1 minute (60 seconds) to timecode 2 minutes (120 seconds).
Again, replace [video1.mp4] with filename or path of your videos.

When the batch is started, first video plays and stops when stop-time is reached. Pressing N (=next) starts the pre-defined sequence of video 2 etc. Pressing key P (=previous), you cand jump back - thus pressing N and P, you cand browse back and foreward as you wish.

Re: Batch for playing several videos from pre-defined time-code

Posted: 20 Jan 2018 19:41
by Jean-Baptiste Kempf
"C:\Program Files\VideoLAN\VLC\vlc.exe" video1.mp4 :start-time 20 :stop-time 90 video2.mp4 :start-time 50 :stop-time 145 --play-and-pause