[mythtv-users] mythtranscode crashes on a .ts HD file

jam at tigger.ws jam at tigger.ws
Tue Jan 15 23:38:00 UTC 2019



> On 15 Jan 2019, at 8:00 pm, mythtv-users-request at mythtv.org wrote:
> 
>>>> 
>>>> To use mythtranscode on h264 with a cutlist you need to use it in fifo
>>>> mode to output raw video which can then be transcoded by ffmpeg or
>>>> similar reading from the fifos.? Or generate the cutlist via mythutil
>>>> and just use ffmpeg directly to cut out those bits and concatenate it
>>>> together.
>>>> 
>>> 
>>> Groan.
>> 
>> It's not too hard when the script is written since it lends itself to
>> automation...
>> 
>>>> If you're familar with perl there's an example I use here at
>>>> http://git.netscum.org.uk/stefan/h264_fifo/src/master/transcode_perl or
>>>> there are many other examples in shell script or python around (at least
>>>> two on the mythtv website).
>>>> 
>>> 
>>> Thank you. I am not familiar with Perl and would understand more from a
>>> shell or Python script. Which ones do you mean? I've done a bit of
>>> searching of the website and there's a hodgepodge of scripts at
>>> https://www.mythtv.org/wiki/Transcode_Video, none of which says clearly
>>> whether it works for HD.
>> 
>> the ones I was thinking of are:
>> 
>> https://www.mythtv.org/wiki/H264_commercial_remover_and_remuxer
>> 
>> which uses a shell script to chop up the file via ffmpeg.? That
>> should be completely lossless but putting the bits back together
>> possibly isn't.? Also
>> 
>> https://www.mythtv.org/wiki/Example_Script_using_mythtranscode_in_fifodir_mode 
>> 
>> 
>> shows mythtranscode working in fifo mode.? I remembered it as python
>> but it's ruby apparently....
>> 
>> I'm happier with perl so I reworked those as examples into something
>> I use.
>> 
>>>> It seems almost impossible to get the cutting exactly right though for
>>>> h264 though.
>>> 
>>> Pity. If it has to be such a faff I may give up on doing it on Linux and
>>> may resort to Premiere, for the few things I really need to export for 
>>> work.
>> 
>> I think there has been Linux video editing software recommended for this
>> sort of thing before but I've never used it, can't remember what it's 
>> called
>> and don't know if it's any better. I think you need to potentially remux
>> to move keyframes around to get cutting perfect with h264 which I've never
>> worked out if ffmpeg will do.
>> 
>> Usually I end up doing the cut close to where it should be with my script
>> and then edit the new file again in mythtv to remove what remained.
>> I'm sure there are better workflows though!
>> 
>> Stefan
> 
> I hadn't seen the script from the mythtv forum, and maybe that will work 
> for you.  Last year I tried vidcutter, which has its own editor/viewer, 
> but it was unable to handle the non-AV streams in my DVB-T2 recordings. 
> Things may have changed since then.

shotcut is a very nice editor, you may select your output formats, but the cutlist is kludgy. They have gone the route of a bundle which makes installing trivially easy (only a single dependancy)

FWIW I offer my solution. You’d need to change STORE and DESTINATION hierarchy.
The mrchanism for choosing the source file is easy and quick. I’d use say 190112 as the search and use mythfront end to qualify by time and/or size and/or channel.

#!/bin/bash

TMPNAME=/store/junk.mpg

echo ------ Recode a HD recording that can\'t be transcoded ---------
echo -n "recording eg 181012 being /store/*201811012*.ts: "
read datetime
echo -------------------------------------------------------
ls -l /store/*$datetime*.ts

echo -------------------------------------------------------
echo -n "Choose the file: "
read srcname

echo -------------------------------------------------------
echo -n "now the name for the recording:  escapr special chars eg \’ \<space>"
read vidname
echo -------------------------------------------------------
if [[ $vidname == *\.* ]]; then
   usename=$vidname
else
    usename=$vidname”.mpg";
fi

prefix=`echo $vidname | head -c 1`
case $prefix in
    [0123456789])
	dir="/store/Movies/Myth0-9/"
	;;
    [ABCabc])
	dir="/store/Movies/MythA-C/"
	;;
    [DEFdef])
	dir="/store/Movies/MythD-F/"
	;;
    [GHIghi])
	dir="/store/Movies/MythG-I/"
	;;
    [JKLjkl])
	dir="/store/Movies/MythJ-L/"
	;;
    [MNOmno])
	dir="/store/Movies/MythM-O/"
	;;
    [PQRpqr])
	dir="/store/Movies/MythP-R/"
	;;
    [STUstu])
	dir="/store/Movies/MythS-U/"
	;;
    [VWXYZvwyzx])
	dir="/store/Movies/MythV-Z/"
	;;
esac

echo -n "GET (existing) cutlist: "
cutlist=`mythutil --getcutlist -q -q --video $srcname | sed -s s/Cutlist://`
echo $cutlist

mythffmpeg -i $srcname -vcodec mpeg2video -acodec copy -aspect 16:9 $TMPNAME
echo mythffmpeg -i $srcname -acodec mpeg2video -vcodec copy -aspect 16:9 $TMPNAME
mythutil --setcutlist $cutlist --video $TMPNAME

mythtranscode -i $TMPNAME --video -o "$dir$usename" --honorcutlist --showprogress -m
stat=$?
if [[ $stat == 0 ]]; then
    mythutil --scanvideos
    echo ------------------------------------------
    echo reCoded $recname AS $dir$usename
    echo ------------------------------------------
else
    echo transcode failed !!
fi

James


More information about the mythtv-users mailing list