<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 23/7/20 9:11 pm, Roland Ernst wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO+qqbOCK0cu9eD-Aaikg-f=OB=VzhXcwYpuULHk7_7jsXek-A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr"><br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Fri, Jul 17, 2020 at
            10:48 AM John Pilkington <<a
              href="mailto:johnpilk222@gmail.com" moz-do-not-send="true">johnpilk222@gmail.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">On 17/07/2020 06:11,
            Kingsley Turner wrote:<br>
            > G'day,<br>
            > <br>
            > I'm trying to understand how the RecordedMarkup cutlist
            works, is there <br>
            > any doco on this?<br>
          </blockquote>
          <div> </div>
          <div>See <a
              href="https://www.mythtv.org/wiki/Recordedmarkup_table"
              moz-do-not-send="true">https://www.mythtv.org/wiki/Recordedmarkup_table</a>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            > <br>
            > What does the "PROG START" type indicate?  I would
            guess it's the end of <br>
            > the first cut (and the cut-start at 0 is not recorded).
            But then a few <br>
            > seconds later is a "CUT END", and now I'm confused.<br>
            <br>
            I haven't seen this presentation before, but I think 'PROG
            START' will <br>
            be the 'mythical bookmark' at the start time read from the
            schedule. <br>
            You may want<br>
            <br>
            "mythutil --getcutlist --chanid  $chanid --starttime
            $starttime"<br>
            <br>
            > <br>
            > Video at [2020-07-17 08:10:00] is
            [/Video4T1/TV/1031_20200717081000.ts]<br>
            > RecordedMarkup.fetch( 1031, 2020-07-17 08:10:00 ) - 24
            Markup Items<br>
            > 24 Markups<br>
            >      Frame 000000 UPDATED CUT<br>
            >      Frame 000000 COMM START<br>
            >      Frame 000000 DURATION MS = 3943000<br>
            >      Frame 000000 TOTAL FRAMES = 98604<br>
            >      Frame 000001 ASPECT 16:9<br>
            >      Frame 000001 VIDEO WIDTH = 1920<br>
            >      Frame 000001 VIDEO HEIGHT = 1088<br>
            >      Frame 000001 VIDEO RATE = 25000<br>
            >      Frame 004398 PROG START<br>
            >      Frame 004585 CUT END<br>
            >      Frame 030921 CUT START<br>
            >      Frame 035813 CUT END<br>
            >      Frame 050072 CUT START<br>
            >      Frame 050075 COMM START<br>
            >      Frame 054825 COMM END<br>
            >      Frame 054837 CUT END<br>
            > <br>
            > I'm trying to create my own transcoder that can handle
            MP4 DVB (as the <br>
            > existing one does not seem to), then working it back
            into the original.<br>
          </blockquote>
          <div><br>
          </div>
          <div>For a transcode task, these bookmarks are of interest:</div>
          <div>MARK_CUT_END and MARK_CUT_START define the part of the
            video/recording,</div>
          <div> which has to be transcoded.</div>
          <div>MARK_UPDATED_CUT indicates that someone else has updated
            the cutlist / markuptable.</div>
          <div>In this case, the ongoing transcoding has to be stopped
            and terminated.<br>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    I haven't been making much progress on this.  <br>
    <br>
    I cut a new video to test, and was absolutely careful to only make
    cut at what MythTV said were "keyframe"s. (I edited the
    database-ouput text above to match)<br>
    <br>
    # mythutil --getcutlist --chanid  1031 --starttime '2020-07-17
    08:10:00'<br>
    Cutlist: 0-4585,30921-35813,50072-54837,65882-70641,79359-98658<br>
    <br>
    The keyframe list dumped by FFMpeg does not match that of MythTV. 
    FFMpeg says the key/index frame for the above is ..., 4511, 4579,
    4685, 4724, 4828, 4901, ...  obviously the closest is 4579 (to the
    first CUT END).  If I cut with FFMpeg at this point, I get about 5
    seconds of video before the MythTV cut.<br>
    <br>
    I thought that maybe I calculated the Frame-index to seconds
    incorrectly (FFMpeg wants a start-time in seconds, so you divide the
    Frame Number by the FPS, e.g.: 4579 / 25 -> 183.16 (seconds)). 
    So I wrote a script to try the cut from every frame from a few
    seconds before to a few after this point, making a hundred or so 5
    second clips.<br>
    The one that looked closest to the MythTV cut-point was at frame
    4621 - not in either list as a keyframe.  <br>
    <br>
    The command I've been testing with is:<br>
    ffmpeg -ss 183.16 -ignore_unknown -i
    /Video4T1/TV/1031_20200717081000.ts -map 0 -map -0:s -t 5 -c:v copy
    -c:a copy cut-4579.mkv<br>
    <br>
    According to everything I've read, using a video output of "copy"
    (-c:v copy) makes FFMPEG only cut at keyframes.  So perhaps it's
    doing its own seeking no matter what I choose.  Supposedly
    re-encoding the video allows more accurate non-key-frame cuts, but I
    think the cut position needs to be correct before worrying about
    this.<br>
    <br>
    Sitting here writing this, the numbers are so far out, it makes me
    wonder if perhaps I'm not looking at the database entries for the
    wrong recording, but I'm fairly sure that's not it.<br>
    <br>
    Probably changing 'mythtranscode' to handle DVB MP4 would be the
    best way forward.<br>
    <br>
    cheers,<br>
    -kt<br>
  </body>
</html>