[mythtv-users] How to Transcode BBC HD and keep AC3 sound intact

Another Sillyname anothersname at googlemail.com
Fri Sep 11 13:13:50 UTC 2009


2009/9/11 Bob Sully <rcs at malibyte.net>:
>
>> Message: 12
>> Date: Wed, 9 Sep 2009 17:45:03 +0100
>> From: Another Sillyname <anothersname at googlemail.com>
>>
>> I've noticed assorted postings on the list previously about
>> transcoding BBC HD material and problems users had keeping the AC3
>> sound intact and synced.
>>
>> With the recent slight change to the transmission method of some BBC
>> HD material I decided to allocate a bit of time to trying to work it
>> out.
>>
>> This is NOT a script and needs to be run from the command line, I'll
>> look to see if there's some way to incorporate this stuff into
>> nuvexport, I'll also have a look at ITV HD to see whether it works for
>> that.
>>
>> You need pretty up to date versions of ffmpeg and mencoder installed
>> on the machine you intend to transcode with, how to install them is
>> outside the scope of this so you'll have to google elsewhere.
>>
>> Firstly create a directory on the machine you intend to perform the
>> transcode on.
>>
>> Open a command session and change to the directory you just created
>> (if you intend to run multiple transcodes simultaneously you need your
>> command session to be in a different directory for each transcode to
>> accommodate the 2 pass file log else they interfere with each other).
>>
>> The following line will do the first pass....
>>
>> ffmpeg -i /path/to/input/file/and/its/name -vcodec mpeg4 -r 25 -map
>> 0:0 -map 0:3 -ss hh:mm:ss.000 -t hh:mm:ss.000 -acodec copy -b 3600k -s
>> hd720 -pass 1 /output/file/path/and/name.avi
>>
>> -vcodec is self explanatory
>> -r 25 forces the frame rate to 25fps - This should always be correct
>> for BBC material
>> -map 0:0 This takes the first stream and outputs it to the output
>> file, 0:0 is nearly always the video stream
>> -map 0:3 This takes the fourth stream and outputs it to the output
>> file, 0:3 is usually the AC3 audio stream
>> -ss Is where you want to create the new file from, as well as
>> hh:mm:ss.000 format you can just use seconds
>> -t Is how long you want the new file to run for, as well as
>> hh:mm:ss.000 format you can just use seconds
>> -acodec is self explanatory - I would suggest doing nothing to the stream
>> -b 3600k Is the bitrate for the recording, 3600k produces a file about
>> 1.1GB for a 40 minute(ish) program - You can dabble here to your own
>> taste.
>> -s hd720 Resizes the output file dimensions to 1280x720 You can have
>> the output file any dimensions you want, use man ffmpeg for other
>> valid dimensions
>>
>> When the first pass has finished check the output file for the correct
>> dimensions, start position and end position, IGNORE timeclock and skip
>> related issues at this point, I'll fix them shortly.
>>
>> If you're happy that the new file starts where you want and ends where
>> you and is the right dimensions then run pass 2
>>
>> ffmpeg -i /path/to/input/file/and/its/name -vcodec mpeg4 -r 25 -map
>> 0:0 -map 0:3 -ss hh:mm:ss.000 -t hh:mm:ss.000 -acodec copy -b 3600k -s
>> hd720 -pass 2 /output/file/path/and/name.avi
>>
>> You'll be asked to confirm you want to overwrite the existing file, say
>> yes.
>>
>> Once this is finished you should have a good file, however it reports
>> the end time incorrectly.
>>
>> The last stage is to re-index the file so that audio and video report
>> the correct file length.
>>
>> mencoder /path//to/output/file/above.avi -oac copy -ovc copy -forceidx
>> -o /path/to/new/output/file.avi
>>
>> You should now have a fully working transcode of the BBC HD material,
>> resized to 720p and with AC3 sound working and in sync.
>>
>> As an example a 40 minute BBC recording takes about 9-10GB in the
>> original format, without any noticeable loss of quality (subjective I
>> realise) this comes down to about 1GB.
>>
>> I've tried this now on about 6 different recordings and it seems to
>> work OK, if anyone has problems please post in the thread.
>
>
> Thanks VERY much for this!!!
>
> I've adapted this to work with US ATSC HD recordings by modifying your
> parameters slightly (to work with a framerate of 59.94 rather than 50) and
> tweaking things a bit:
>
> ffmpeg -i 4071_20090802205900.mpg -vcodec mpeg4 -r 29.97 -map 0:0 -map 0:1
> -ss 00:00:00.000 -t 02:03:08.090 -acodec copy -b 3000k -s hd720 -pass 1
> DG090802.avi
>
> 0:1 seems to be the 5.1 AC3 stream in the recordings I've tried so far.
> To attempt to decrease the file sizes a bit, I've gone with 3K bitrate
> rather than 3.6.
>
> Interestingly, the SECOND pass doesn't always seem to work - sometimes
> aborts.  If there's something I'm doing wrong there, please clue me in,
> However, I get excellent quality even with the first pass only.
>
> After the mencoder step, I edit out the commercials using avidemux and
> save with Video/x264 (two pass with approx 1GB file size per 40-42 minute
> episode with commercials removed), Audio/copy, and filetype .mkv. (or, if
> the .avi file size is OK, just save with Video/copy, Audio/copy and AVI)
> So far, the two files I've created have turned out quite nicely.
>
> Thanks again - now, if we can get this to work with h.264 files from the
> HD-PVR, I'm in nirvana.
>
> Bob
>
> --
> ________________________________________
> Bob Sully - Simi Valley, California, USA
> http://www.malibyte.net
> http://www.malibyte.com
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>

What error message are you getting?


More information about the mythtv-users mailing list