How to calculate the total time for a playlist from the XML file?

hello, I was working on a small project and I came up with the need to know the total time of a playlist from the XML file. in the example below, Shotcut shows that the total is 33,18/30 seconds (33.6s) but when I do the addition of all producers (except tractors) I get 33.237 seconds. What I’m doing wrong? Thank you in advance for any kind of help.

> <playlist id="playlist1">
>     <property name="shotcut:video">1</property>
>     <property name="shotcut:name">V1</property>
> 		<entry producer="producer8" in="00:00:00.000" out="00:00:04.100"/>
> 		<entry producer="producerA" in="00:00:00.033" out="00:00:02.467"/>
> 		<entry producer="tractorA" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerB" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorB" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerC" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorC" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerD" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorD" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerE" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorE" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerF" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorF" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerG" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorG" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerH" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorH" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerI" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorI" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerJ" in="00:00:00.500" out="00:00:02.467"/>
> 		<entry producer="tractorJ" 	in="00:00:00.000" out="00:00:00.467"/>
> 		<entry producer="producerK" in="00:00:00.500" out="00:00:04.467"/>
> </playlist>

Tractors should count towards the elapsed time. They are transitions. I’m guessing we are looking at a photo slideshow project here?

The trick is to convert timestamps to frames, add up the frames, then convert back to time. So, the result will be dependent on the frame rate.

Also, the out point is the timestamp of the beginning of the last frame shown. It is not the timestamp at the end of the last frame shown. Frames on the timeline can be treated like addressable bytes of RAM, where each timestamp is an address to a slot rather than a literal unit of passing time. As such, there may be +/- 1 frame needed depending on whether you want a slot address (beginning of the frame) or a duration (include time to the end of the frame).

I’ve attached a LibreOffice spreadsheet with the conversion math embedded as formulas. I get 33.633 elapsed seconds. Shotcut seems to be telling you 33.600 seconds, which appears to be the “address”/beginning of the final frame, but we need to play through the final frame to finish the video.
So, I’m pretty sure the elapsed time is actually 33.633 seconds.

Playlist elapsed (14.1 KB)


Thank you so much @Austin, you solved my issue.

1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.