[mythtv-users] nuvexport and ffmpeg

Mark Chang mark.chang at gmail.com
Fri Feb 23 04:40:46 UTC 2007


On 2/19/07, Chris Petersen <lists at forevermore.net> wrote:
> Your version should theoretically be fine.  I'd suggest running through
> nuvexport in --debug mode (instructions in the mythtv wiki) to see what
> it's using for the video bitrate parameters.  It's possible that
> nuvexport just isn't detecting your version of ffmpeg properly.

It turns out the parameter "sniffing" that the nuvexport scripts do
don't quite get it right. It was defaulting to 200kbps for the video
encoding rate, taking my one hour of Battlestar to around 150MB with
whatever bit rate I set.

I tried fixing it, and FFMPEG apparently encoded it at a higher
bitrate (1500kbps yielding 600MB or so), but the quality is still crap
compared to a 960kbps transcode using transcode.

My fixes to ffmpeg.pm:
# $Date: 2007-02-11 12:48:33 -0800 (Sun, 11 Feb 2007) $
# $Revision: 312 $
# $Author: xris $

(latest svn as of today)

In ffmpeg.pm, around line 94
(https://svn.forevermore.net/nuvexport/browser/trunk/export/ffmpeg.pm#L95)

we have a quick regexp that tries to determine the parameter version
of the installed ffmpeg like this:
    # Load the parameter version?
        $data = `$ffmpeg -h 2>&1`;
        if ($data =~ /bit_rate_tolerance/) {
            $self->{'ffmpeg_param_vers'} = 0;
        }
        else {
            $self->{'ffmpeg_param_vers'} = 1;
        }

Not knowing ffmpeg, I guess this is a reasonable way to determine the
set of valid parameters? Anyways, on my version, this yields a
ffmpeg_param_vars of 0 because it finds "bit_rate_tolerance" way at
the end of the ffmpeg -h output.

Later, on line 137,
https://svn.forevermore.net/nuvexport/browser/trunk/export/ffmpeg.pm#L137

we switch on the parameter version like this:
    # Which version?
        if ($self->{'ffmpeg_param_vers'} == 1) {

which, for me, ignores all the parameter goodness :(. So I switched it to:
        if ($self->{'ffmpeg_param_vers'} == 0) {

which gets me the parameter mapping necessary for xvid to at least work.

One additional change was in the bitrate calculation. My version of
ffmpeg defaults to taking the value in kb/s, not b/s, so I changed
line 140 to get rid of the 1024 multiplier:
https://svn.forevermore.net/nuvexport/browser/trunk/export/ffmpeg.pm#L140

so it looks like this:
            return param_pair('b',              $value)        if
($param eq 'bit_rate');

Anyways, all that and it still looks terrible and the file size is
big. What is going on? Anyone get good encodings with ffmpeg?

-- 
Mark L. Chang


More information about the mythtv-users mailing list