jaskie / Server

This fork of CasparCG Server contains enhancements used in broadcast play-out system used in TVP.
http://playoutautomation.tvp.pl
GNU General Public License v3.0
20 stars 5 forks source link

Absolute position and duration in FFMpeg producer INFO #7

Closed martastain closed 4 years ago

martastain commented 4 years ago

In server versions prior ~7.3, file-frame-number and file-nb-frames values were present in the INFO XML providing information about untrimmed file duration and absolute position within the file.

Would it be possible to bring these back along with current frame-number and nb-frames values? It is useful for seeking in the file currently playing.

jaskie commented 4 years ago

But the frame-number now is actual producer position in file, so it seems to be the same. In contrary, nb-frames may be limited, if file is loaded with LENGTH parameter, so I can add it easily. Maybe describe your expectations regarding the command output?

jaskie commented 4 years ago

IMHO the best would be if:

martastain commented 4 years ago

This change was introduced in 7.3b. I was wrong in my statement that frame-number is relative to the in-point defined by seek parameter, but as you can see from the following xmls, behavior is different between previous version and the current one.

In this example, I started 1 minute clip with SEEK 250 LENGTH 500 parameters and 40ms later I executed an INFO command for this layer. In 7.0, file-frame-number and file-nb-frames represents position within the file and nb-frames represents the duration of the region defined by SEEK and LENGTH command.

In 7.3b and 8.0 there are frame-number and nb-frames values. nb-frames works in the same way as before and frame-number works as the former file-frame-number.

7.0

<?xml version="1.0" encoding="utf-8"?>
<layer>
   <status>playing</status>
   <auto_delta>-1</auto_delta>
   <frame-number>2</frame-number>
   <nb_frames>500</nb_frames>
   <frames-left>499</frames-left>
   <frame-age>59</frame-age>
   <foreground>
      <producer>
         <type>ffmpeg-producer</type>
         <filename>c:\playout\media.dir\pxd.mxf</filename>
         <width>1920</width>
         <height>1080</height>
         <progressive>false</progressive>
         <fps>25</fps>
         <loop>false</loop>
         <nb-frames>500</nb-frames>
         <file-frame-number>251</file-frame-number>
         <file-nb-frames>1500</file-nb-frames>
      </producer>
   </foreground>
   <background>
      <producer>
         <type>empty-producer</type>
      </producer>
   </background>
   <index>1</index>
</layer>

7.3b

<?xml version="1.0" encoding="utf-8"?>
<layer>
   <status>playing</status>
   <auto_delta>-1</auto_delta>
   <frame-number>2</frame-number>
   <nb_frames>500</nb_frames>
   <frames-left>499</frames-left>
   <frame-age>34</frame-age>
   <foreground>
      <producer>
         <type>ffmpeg-producer</type>
         <filename>c:\playout\media.dir\pxd.mxf</filename>
         <file-width>1920</file-width>
         <file-height>1080</file-height>
         <file-fps>25</file-fps>
         <file-progressive>false</file-progressive>
         <fps>25</fps>
         <loop>false</loop>
         <nb-frames>500</nb-frames>
         <frame-number>251</frame-number>
      </producer>
   </foreground>
   <background>
      <producer>
         <type>empty-producer</type>
      </producer>
   </background>
   <index>1</index>
</layer>

In my opinion, the best possible scenario would be having all four values as in 2.0.7:

<?xml version="1.0" encoding="utf-8"?>
<layer>
   <status>playing</status>
   <auto_delta>-1</auto_delta>
   <frame-number>2</frame-number>
   <nb_frames>500</nb_frames>
   <frames-left>499</frames-left>
   <frame-age>24</frame-age>
   <foreground>
      <producer>
         <type>ffmpeg-producer</type>
         <filename>c:\playout\media.dir\pxd.mxf</filename>
         <width>1920</width>
         <height>1080</height>
         <progressive>false</progressive>
         <fps>25</fps>
         <loop>false</loop>
         <frame-number>2</frame-number>
         <nb-frames>500</nb-frames>
         <file-frame-number>252</file-frame-number>
         <file-nb-frames>1500</file-nb-frames>
      </producer>
   </foreground>
   <background>
      <producer>
         <type>empty-producer</type>
      </producer>
   </background>
   <index>1</index>
</layer>

Is this possible to do? I can do some kind of abstraction to handle differences between versions, but i believe this would be the most universal way.

jaskie commented 4 years ago

Just released. Now, frame-number's are always counted from zero after seek. The seek values are absolute (as it was before). You can seek to point before original start, but can't seek after original start + duration. The playout will continue until original seek + duration is reached. Please check, then close the issue if it's OK.

martastain commented 4 years ago

This is perfect. Thank you very much!