[mythtv-users] Cutting HD-PVR recordings

Bob Sully rcs at malibyte.net
Fri Dec 11 18:06:44 UTC 2009

>>On Fri Dec 11 15:31 , Doug Vaughan <r.d.vaughan at rogers.com> wrote:For
>> HDPVR recordings I use Avidemux to manually perform lossless edits.
>>The restriction is that I must force my STB to only output at 720p. You
>>must save the edited file in an avi container and then use ffmpeg to
>>copy file avi into a mkv and add a seek table. The audio sync and
>>general quality has been excellant. On the rare occassion that there is
>>an audio seek issue, I use mkvmerge_gui to resync the audio.
>>To make this experience easier I created a Nautilus script that combines
>>starting Avidemux and creating the mkv file with ffmpeg after you exit
>>I also use a compiled version of Avidemux as my distro's package seems
>>to lack some options (Ubuntu 9.10).
>>One other thing I should mention is that before editing I have a userjob
>>to rename the recording and copy it to a physically separate hard drive.
>>Editing and recording at the same time cause disk thrashing which will
>>cause issues if you are recording at the same time. You can use rsync
>>with bandwidth option (--bwlimit) in the userjob to control the disk
>>thrashing during the copy and rename process.
>>Although this article is out of date the section on Avidemux and the
>>HDPVR is correct.
> Thanks Doug,
>   Especially for the tips about compiling avidemux, and the disk thrashing
> issue. I have some spare disk space on a separate drive that I didn't
> know what to do with, now it seems it might be useful after-all ;-)
> Cheers!
> Marius

Someone on the list (maybe it was Doug? - sorry, can't recall at the
moment) passed me this two-pass ffmpeg command sequence, which does a
great job of transcoding the raw HD-PVR recording to an .avi, which I then
edit manually with avidemux and save to my mythvideo directory with a
filename that the metadata grabber can recognize.

ffmpeg -i /mythrec/1/myth-1/1456_20091204230000.mpg -vcodec mpeg4 -r 29.97
-map 0:0 -map 0:1 -ss 00:00:00.000 -t 01:31:52.150 -acodec copy -b 3600k
-s hd720 -pass 1 /video/SOA-1.avi


ffmpeg -i /video/SOA-1.avi -vcodec mpeg4 -r 29.97 -map 0:0 -map 0:1 -ss
00:00:00.000 -t 01:31:52.150 -acodec copy -b 3600k -s hd720 -pass 2

The -t parameter is the actual duration of the recording, which I get by
running the first command with any number over 1 hr for -t (for a few
seconds), then hitting ctrl-C and changing it to the actual length, which
is displayed on stdout.  The -r parameter is the frame rate per second, -b
is the bit rate, -map 0:0 is the video and 0:1 in this case is the 5.1 AC3
soundtrack.  I had problems in the past using the RCA 2ch output - none
since switching over to the SPDIF output.

I have my STB outputting to the HD-PVR in 720p.  I have not tried it with
1080i yet.

I edit out the commercials with avidemux manually, which after you get the
hang of it, takes only a few minutes for a 1-2 hour show.  The resulting
40-minute .avi file after editing is usually right around 1G in size, with
excellent quality.

Works great, though it's not "automated".  When I have time I'll write a
little script to do that....


Bob Sully - Simi Valley, California, USA

More information about the mythtv-users mailing list