<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Sep 24, 2016 at 5:58 PM, Stephen Worthington <span dir="ltr"><<a href="mailto:stephen_agent@jsw.gen.nz" target="_blank">stephen_agent@jsw.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sat, 24 Sep 2016 09:09:58 -0700, you wrote:<br>
<br>
>Hello All,<br>
><br>
>I've written a tool to interface with the "ExternalRecorder" feature in<br>
>0.28. I've got everything working, including an EPG.<br>
><br>
>I am trying to harden the tool now. In my tool, I use FFMPEG to pull the<br>
>source and convert it to an MPEG-TS for the External Recorder. Every now<br>
>and again, the stream dies and needs to be restarted. If I don't do<br>
>anything, MythTV records until the stream dies. The tool seems to properly<br>
>detect the failure and restart the stream, but in the frontend the video<br>
>becomes corrupted. I am assuming that this is because FFMPEG died before<br>
>setting a complete frame... The underlying video is in H.264.<br>
><br>
>I am not even sure how to phrase the question... Anyone know how to have<br>
>the "new" stream append cleanly? Or, can I force MythTv to just restart the<br>
>ExternalRecorder when it dies?<br>
><br>
>I'd rather have a continuity error, than only 30 mins of 3 hour sports<br>
>event. :)<br>
><br>
>Thanks in advance for help and guidance.<br>
>Marc<br>
<br>
</div></div>Here are some ideas that came to mind:<br>
<br>
One way to do it might be to record to a new file somehow each time<br>
the stream is disrupted, then use ffmpeg or some other tool to merge<br>
the files at the end of the recording.  The merge process might make<br>
the tool used correctly close off the stream from one file before<br>
starting the next.<br></blockquote><div><br></div><div>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).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Do the files your recorder produces have all the data from after the<br>
stream dies recorded, or does the recording stop at the discontinuity?<br>
If all the data is there, a tool that repairs bad TS files might be<br>
the answer.  Just run it automatically at the end of the recording, or<br>
send the streams through it before writing them to the recording file.<br></blockquote><div><br></div><div>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.</div><div><br></div><div><snip></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I am looking for a way to record SAT>IP streams in MythTV, which it is<br>
not yet able to do.  So I was wondering if your external recorder code<br>
was able to record that sort of stream?  If so, I would love to be<br>
able to try it out.  Even if it does not handle SAT>IP streams, it<br>
would still be good to see how you have made a working external<br>
recorder, in case I need to write my own one for SAT>IP.  I am<br>
unlikely to have disruptions in my streams as I am only intending to<br>
record from SAT>IP tuners on other boxes in my local network, or even<br>
from the same PC.<br></blockquote><div><br></div><div>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). </div><div><br></div><div>My next steps are to refactor the code to have better separation between the specifics of my needs and a generic interface.</div><div><br></div><div>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).</div><div><br></div><div>Thanks,</div><div>Marc</div><div><br></div><div>PS: I think it has recorded 9+ hours error free this week, so I may defer the hardening work.</div><div><br></div><div> </div></div></div></div>