ACMP command to get media length

playout
client
getting-started

#1

Hi everyone,
I’d like to play out multiple videos. I start with sending PLAY 1-1 “1.mp4” command. How can I get media length from server? I need this info for start playing the second video.
Thanks.
Br,
Zsolt


#2

CINF should do what you need.

You can use LOADBG AUTO to make caspar automatically play another clip when it reaches the end, but you may still want to know the clip length to queue up clips


#3

Which another clip is played by LOADBG AUTO? How does it choose?


#4

See the wiki for explaination of command arguments.


#5

Only one clips can be loaded in the background at the time, pr. layer.


#6

Because I’ve wanted to do a video playlist in livecode I had to load the first clip. Then use bgload for the second clip
Then ask it for info on the layer that’s playing. Take the information and pull the total frames and frame rate of the clip to get its length. Then wait that length plus one second to bgload the 3rd clip since by now the 2nd clip is playing. Then info again will give me the info for the 2nd clip. Info will tell you how many frames, frame rate, and current frame it’s on. This is how I can sort out when to trigger the next bgload. It’s a wash, rince repeat thing until I’m out of clips where I either stop or loop back to 1st clip. It’s also very crude approach.


#7

I’ve done the same thing right now: simple playback on LiveCode. A small advice: as long as clip is playing use INFO command. Do it twice a second or more. Receive feedback from Caspar and parse it to find xxx where xxx is number of current frame. Also check for xx to find out frame rate and then <nb_frames>xxx</nb_frames> this will be a total frames number in media. Then “(nb_frames-curFeame)/fps” (actual numeric values) will be the seconds remaining till the end of playing media. According to the size and dimensions of next media, you should use LOADBG to load the next file 2-3 seconds before the previous will be finished.
I have some other options in my player, but this is the basic trick to implement continuous playback.
There is another way to do this: use OSC from Caspar. It is a bit more difficult, but it is more sharper