[mythtvnz] nuvexport of HD recordings

Nick Rout nick.rout at gmail.com
Wed Feb 17 20:40:42 GMT 2010


On Wed, Feb 17, 2010 at 10:34 PM, Tony Sauri <hoiho.nz at gmail.com> wrote:
> On Tue, 16 Feb 2010 22:59, Robin Gilks wrote:
>> Looking forward to it...
>>
>>
>> --
>> Robin Gilks
>
> Well I promised so I had better get started however there is a chance this
> will be a bit disjointed as I am on holiday and away from my main pc and my
> notes and more importantly WAF dictates that I can not spend all day polishing
> this message.
>
> Where to start?
>
> First my environment
>
> My Backend is a 3GHz P4 with 1 GB RAM.  I have installed Mythbunto 9.04 and
> then then I installed JYA's fixes for VDPAU (even though my F/E does not have
> NVidia componetnts) as I thought at the time this was the easiest way to get
> Paul Kendall's LATM patch for FFMPEG
>
> The Frontend is an IBM T23 laptop (1.13GHz)also running Mythbuntu 9.04 with
> JYA's fixes.
>
> After absorbing the quite compelling message imparted by trying to watch DVB-T
> HD tv on an under-powered platform I decided that the way forward would be to
> downrate the recorded files to DVD quality   that would play adequately on my
> frontend platform while retaining all the functionality of the Myth platform.
>
> My first experiments were with FFMPEG that I have used quite extensively over
> the last few years and it is my transcoder of choice.
> About this time I realised that JYA's fixes for LATM were only in the private
> Myth FFMPEG library and not in the general FFMPEG software.  So I built a
> local version of FFMPEG that had PK's patch applied
>
> My first problems were trying to keep audio and video in sync after much
> experimentation I found that the -itsoffset parameter was crytical and -async
> 1 parameter seemed to add aditional benefit although I am not fully convinced
> about -async.
>
> I then started searching for how to calculate with precision the time
> adjustment to give -itsoffset.  My quest led me to 2 pieces of software a)
> MEDIAINFO from http://mediainfo.sourceforge.net/en and b) FFPOCKET from
> http://members.hellug.gr/djart/ffpocket/index.html.  By using information
> from both programmes I seem to have struck a formula which works for me.
>
> I then saw it as important to seamlessly integrate the transcoded file back
> into the Myth system.
>
> I have had to regenerate the entries in the markup table to facilitate
> navigation and comm flagging.  To do this I had to understand how Myth
> generates the markup table entires in the first place.  They are created in
> the nupplevideo recorder function  and I understand that they are generated a
> fixed number of frames apart irrespective of the encoding of the incoming
> datastream.  I thought this was going to be the end of my journey until
> reading the myth code I discovered that the strict fixed number of frames per
> gop did not apply to the avi container.
>
> After determining that Myth seemed to process an playback an avi file
> correctly i used this container as my standard so now my FFMPEG command line
> looks a mlittle like this:
>
> nice -n 19 /home/mythtv/bin/ffmpeg $itsoffset_term -i $recordedfile -acodec
> libmp3lame -ab 128k -ac 2 -ar 48000 -vol 384 -vcodec mpeg4 -b 4500k -r 25 -s
> 720x576 -croptop 2 -cropbottom 2 -padtop 2 -padbottom 2 -f avi -y -async 1 -g
> 15 $deinterlace_term $transcodedfile
>
> The four variables would look like:
> $itsoffset_term         =       -itsoffset -234
> $recordedfile           =       /var/lib/mythtv/recordings/1001_20100217221000.mpg
> $deinterlace_term       =       -deinterlace    or      "blank"
> $transcodedfile         =       /var/lib/mythtv/recordings/1001_20100217221000.mpg.tmp
>
> Once the transcoded file has been created the only things left to do are to
> rename the files to their new locations, cleanup the database by deleting,
> blanking certain fields in the recorded table, deleting entries in the
> recordedmarkup and recordedseek tables followed by the use of mythcommflag to
> a) rebuild the recordedseek entries and then if appropriate use mythcommflag
> to flag for commercials.
>
> All this is setout in the attached perl script.
>
> Note: this is not my current production script and contains much hardcoded
> stuff.  As said before I am on holiday and do not have access to my usual
> system at the moment.
>
> When I get back home ... end of next week I will be willing to post the
> current script for your info and use.
>
> I hope this has been of some use to Robin and others.

I'd say from my lurking on the mythtv-users mailing list that it will
help more than just members of the NZ list.



More information about the mythtvnz mailing list