[mythtv-users] [OT] Recover from interrupted streams

Marc Rawji mrawji at gmail.com
Sun Sep 25 04:58:27 UTC 2016


On Sat, Sep 24, 2016 at 5:58 PM, Stephen Worthington <
stephen_agent at jsw.gen.nz> wrote:

> On Sat, 24 Sep 2016 09:09:58 -0700, you wrote:
>
> >Hello All,
> >
> >I've written a tool to interface with the "ExternalRecorder" feature in
> >0.28. I've got everything working, including an EPG.
> >
> >I am trying to harden the tool now. In my tool, I use FFMPEG to pull the
> >source and convert it to an MPEG-TS for the External Recorder. Every now
> >and again, the stream dies and needs to be restarted. If I don't do
> >anything, MythTV records until the stream dies. The tool seems to properly
> >detect the failure and restart the stream, but in the frontend the video
> >becomes corrupted. I am assuming that this is because FFMPEG died before
> >setting a complete frame... The underlying video is in H.264.
> >
> >I am not even sure how to phrase the question... Anyone know how to have
> >the "new" stream append cleanly? Or, can I force MythTv to just restart
> the
> >ExternalRecorder when it dies?
> >
> >I'd rather have a continuity error, than only 30 mins of 3 hour sports
> >event. :)
> >
> >Thanks in advance for help and guidance.
> >Marc
>
> Here are some ideas that came to mind:
>
> One way to do it might be to record to a new file somehow each time
> the stream is disrupted, then use ffmpeg or some other tool to merge
> the files at the end of the recording.  The merge process might make
> the tool used correctly close off the stream from one file before
> starting the next.
>

I am not sure that I can do this... the 'external recorder' reads and
writes from STDOUT/ERR and STDIN, so, no file to close off (on my end,
anyways).


>
> Do the files your recorder produces have all the data from after the
> stream dies recorded, or does the recording stop at the discontinuity?
> If all the data is there, a tool that repairs bad TS files might be
> the answer.  Just run it automatically at the end of the recording, or
> send the streams through it before writing them to the recording file.
>

I don't see why they wouldn't. I'll give that a go. It won't help for
'LiveTV', but should be perfectly good for Recorded shows.

<snip>

>
> I am looking for a way to record SAT>IP streams in MythTV, which it is
> not yet able to do.  So I was wondering if your external recorder code
> was able to record that sort of stream?  If so, I would love to be
> able to try it out.  Even if it does not handle SAT>IP streams, it
> would still be good to see how you have made a working external
> recorder, in case I need to write my own one for SAT>IP.  I am
> unlikely to have disruptions in my streams as I am only intending to
> record from SAT>IP tuners on other boxes in my local network, or even
> from the same PC.
>

I don't really see why it wouldn't. It's in a "it works for me stage", not
super ready to share yet, but I am working on it still. Very generically,
it implements the correct interface of the external recorder and then uses
FFMPEG to produce the Transport Stream... if you can pull your SAT>IP
stream through FFMPEG (or anything else that'll write to STDOUT), it should
work. The code's in python (and I am just learning Python).

My next steps are to refactor the code to have better separation between
the specifics of my needs and a generic interface.

Let me know if you think that'll work for you, and I'll find a way to share
it (we can do that off list).

Thanks,
Marc

PS: I think it has recorded 9+ hours error free this week, so I may defer
the hardening work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20160924/2a690f5a/attachment.html>


More information about the mythtv-users mailing list