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

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
babel
New Cone
New Cone
Posts: 2
Joined: 19 Dec 2017 22:54

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

Postby babel » 19 Dec 2017 23:06

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.

babel
New Cone
New Cone
Posts: 2
Joined: 19 Dec 2017 22:54

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

Postby babel » 14 Jan 2018 12:44

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.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

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

Postby Jean-Baptiste Kempf » 20 Jan 2018 19:41

"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
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 4 guests