Difference between revisions of "User talk:Iamlindoro"

From MythTV Official Wiki
Jump to: navigation, search
(compiling xport under linux: new section)
 
(24 intermediate revisions by 12 users not shown)
Line 1: Line 1:
This is a script that will correct broken MPEG-2 TSs from firewire or DVB.  The script replaces the original recording with a file that will work with mythtranscode rather than crashing it.
+
It's fine to not be supported, but that text in the wiki, but there are many people that run Myth this way and the wiki is supposed to be a resource for the users to store this type of information and you need to leave it in.
  
<code><pre>
 
#!/bin/sh
 
#
 
#
 
# mpeg2fixup.sh
 
#
 
# Written in 2008 by Robert McNamara.  Please redistribute freely and without
 
# restriction. (robert DOT mcnamara ATSIGN g m a i l DOTCOM)
 
#
 
# Script to clean up Firewire and DVB recordings that kill mythtranscode.
 
# It appears the bogus PTS information makes mythtrascode lossless transcoding
 
# fail with error 232 (Unknown).  It complains about a deadlock.
 
#
 
# This solution is not the most elegant in the world, but it *does* work and
 
# ultimately permits Myth to successfully lossless-transcode the files.
 
#
 
# There are two prerequisites for this script.  The first is the xport
 
# transport stream demuxer.  It is only distributed for Windows but it compiles
 
# fine on linux.  Get the following file:
 
#
 
# http://www.w6rz.net/xport.zip 
 
#
 
# And unzip it.  Compile it with "cc -o xport xport.c" and copy the resulting
 
# file to somewhere in your path (in my case, /usr/bin).
 
#
 
# You will also need a copy of ffmpeg with AC3 and MPEG-2 support.
 
#
 
# In essence, this script demuxes the file recorded from DVB/Firewire, and
 
# remuxes the streams with ffmpeg into a "clean" MPEG container.  It copies the
 
# existing recording file to the same location with extension .tmp and inserts
 
# the new file in its place.  Commercial flags and cutlists are cleared, and
 
# commflagging is run on the new file.  In my limited testing, Myth can now
 
# successfully transcode the resulting file losslessly.
 
#
 
# Here's how it should be set up as a userjob:
 
#
 
# mpeg2fixup.sh "%DIR%" "%FILE%"
 
#
 
# I set the script to work within /tmp.  If you don't want it to do that,
 
# change the first variable below.
 
  
WORKINGDIR=/tmp
+
Hi there,
  
DIR=$1
+
I beg to differ. Isn't that what a MUG is all about - people who use Myth and their experiences getting it working. I've used links where the info is readily available on other wikis, but the rest of the info was my personal experience. I had been to the South African MUG with the hope that someone nearby had been through the same experience I had, and frankly, the info on that page is pretty useless. Looking at the South African MUG, the only thing relevant to the South African MUG would be how to make use of XML schedule file from flash.za.org. All the other info is either old, outdated or obselete (even the XMLTV section was invalid before I got hold of it).
FILE=$2
 
  
# Make the directory to work in:
+
I just followed the template created by the original authors and hoped to share my experience.
mkdir "$WORKINGDIR/$FILE"
 
cd "$WORKINGDIR/$FILE"
 
  
# First step is dumping the PIDs to files
+
Velouria
xport "$DIR/$FILE" 1 1 1
 
 
 
# Once we're done with that, let's mux everything into a new file.
 
ffmpeg -i bits0001.mpv -i bits0001.mpa -vcodec copy -acodec copy "$WORKINGDIR/$FILE/$FILE"
 
  
# Let's move the old file out of the way, and the new file into its place.
+
Ok - I've shuffled some stuff around - let me know if it's ok.
mv "$DIR/$FILE" "$DIR/$FILE.old"
 
mv "$WORKINGDIR/$FILE/$FILE" "$DIR/$FILE"
 
  
# Now we need to clear the cutlist on the file, rebuild its seektable, and rerun commflagging.
+
== compiling xport under linux ==
  
mythcommflag --clearcutlist -f "$DIR/$FILE"
+
I had an issue compiling xport under linux. I got the following error:
ERROR=$?
 
if [ $ERROR -ne 0 ]; then
 
        echo "Clearing cutlist failed for $FILE with error $ERROR"
 
        exit $ERROR
 
fi
 
  
# *Don't* rebuild the seektable traditionally or you will end up with screwed up times and it will be uneditable.
+
$ cc -o xport xport.c
# Use mythtranscode on lossless/buildindex mode instead.
+
xport.c: In function ‘parse_vc1_video’:
 +
xport.c:1942:8: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat]
 +
xport.c:1990:8: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat]
 +
$
  
mythtranscode --mpeg2 --infile "$DIR/$FILE" --buildindex --showprogress
+
A look at lines 1942 and 1990 in xport.c showed the problem to be with the frame_rate type. I bit of searching for frame_rate and I found the offending line, 1601
ERROR=$?
 
if [ $ERROR -ne 0 ]; then
 
        echo "Rebuilding seektable failed for $FILE with error $ERROR"
 
        exit $ERROR
 
fi
 
  
mythcommflag -f "$DIR/$FILE"
+
I changed line 1601 from:
ERROR=$?
 
if [ $ERROR -ne 0 ]; then
 
        echo "Commercial flagging failed for ${FILENAME} with error $ERROR"
 
        exit $ERROR
 
fi
 
  
# Remove the contents of the working directory
+
static longdouble frame_rate = 1.0;
rm -rf "$WORKINGDIR/$FILE"
+
 
# If you want to remove the old recording, uncomment the last line:
+
to:
# rm "$DIR/$FILE.old"
+
 
</pre></code>
+
static double frame_rate = 1.0;
 +
 
 +
I thought you might like to include this info somewhere for those that want to compile xport for the mpeg2fixup.sh script.

Latest revision as of 20:05, 10 January 2013

It's fine to not be supported, but that text in the wiki, but there are many people that run Myth this way and the wiki is supposed to be a resource for the users to store this type of information and you need to leave it in.


Hi there,

I beg to differ. Isn't that what a MUG is all about - people who use Myth and their experiences getting it working. I've used links where the info is readily available on other wikis, but the rest of the info was my personal experience. I had been to the South African MUG with the hope that someone nearby had been through the same experience I had, and frankly, the info on that page is pretty useless. Looking at the South African MUG, the only thing relevant to the South African MUG would be how to make use of XML schedule file from flash.za.org. All the other info is either old, outdated or obselete (even the XMLTV section was invalid before I got hold of it).

I just followed the template created by the original authors and hoped to share my experience.

Velouria

Ok - I've shuffled some stuff around - let me know if it's ok.

compiling xport under linux

I had an issue compiling xport under linux. I got the following error:

$ cc -o xport xport.c xport.c: In function ‘parse_vc1_video’: xport.c:1942:8: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat] xport.c:1990:8: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘long double’ [-Wformat] $

A look at lines 1942 and 1990 in xport.c showed the problem to be with the frame_rate type. I bit of searching for frame_rate and I found the offending line, 1601

I changed line 1601 from:

static longdouble frame_rate = 1.0;

to:

static double frame_rate = 1.0;

I thought you might like to include this info somewhere for those that want to compile xport for the mpeg2fixup.sh script.