Log in

View Full Version : too many frames for .stats file?


njahnke
23rd January 2009, 07:26
trying to encode a 240x160 1237903-frame video 2pass with 0.59.859 ce13bb6, 0.65.1074M b6bb3d4 and 0.66.1086 39a2796 results in "can't open stats file" at the start of the second pass (it hangs for maybe 10-20 seconds before dying):

C:\Documents and Settings\Administrator>"C:\Program Files\anri_4a1\x264.1074M.ex
e" --pass 1 --bitrate 512 --vbv-maxrate 768 --direct auto --stats "P:\firered\Po
kemonFireRed_E4R2_SS_516.stats" --no-cabac --analyse none --qpmin 17 --threads 2
--thread-input --progress --no-psnr --no-ssim --output NUL "P:\firered\PokemonF
ireRed_E4R2_SS_516.avs"
avis [info]: 240x160 @ 59.94 fps (1237903 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile Baseline, level 2.0
x264 [info]: slice I:11425 Avg QP:18.08 size: 4545
x264 [info]: slice P:1226478 Avg QP:20.07 size: 1030
x264 [info]: mb I I16..4: 45.2% 0.0% 54.8%
x264 [info]: mb P I16..4: 9.0% 0.0% 0.0% P16..4: 65.0% 0.0% 0.0% 0.0% 0
.0% skip:26.0%
x264 [info]: final ratefactor: 18.14
x264 [info]: kb/s:509.5

encoded 1237903 frames, 125.31 fps, 509.61 kb/s

C:\Documents and Settings\Administrator>"C:\Program Files\anri_4a1\x264.1074M.ex
e" --pass 2 --bitrate 512 --vbv-maxrate 768 --direct auto --level 1.3 --stats "P
:\firered\PokemonFireRed_E4R2_SS_516.stats" --mixed-refs --no-cabac --subme 6 --
trellis 2 --analyse all --me umh --qpmin 17 --threads 2 --thread-input --progres
s --no-psnr --output "P:\firered\PokemonFireRed_E4R2_SS_516v.mp4" "P:\firered\Po
kemonFireRed_E4R2_SS_516.avs"
avis [info]: 240x160 @ 59.94 fps (1237903 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [warning]: VBV maxrate specified, but no bufsize.
x264 [error]: ratecontrol_init: can't open stats file
x264 [error]: x264_encoder_open failed

C:\Documents and Settings\Administrator>

encoding the same video decimated by 3 works fine.

http://nate.quandra.org/PokemonFireRed_E4R2_SS_516.stats

is the stats file corrupt? is there some kind of hard limit for number of frames? or is something else going on? any insight would be much appreciated.

Sharktooth
23rd January 2009, 14:11
i think x264 is actively refusing to encode "pokemon"... :D

now, seriously, open the stats file with a text editor and look at the content. more likely there is another kind of problem with the stats.

Dark Shikari
23rd January 2009, 14:15
That error means the following function returned NULL:

char *x264_slurp_file( const char *filename )
{
int b_error = 0;
int i_size;
char *buf;
FILE *fh = fopen( filename, "rb" );
if( !fh )
return NULL;
b_error |= fseek( fh, 0, SEEK_END ) < 0;
b_error |= ( i_size = ftell( fh ) ) <= 0;
b_error |= fseek( fh, 0, SEEK_SET ) < 0;
if( b_error )
return NULL;
buf = x264_malloc( i_size+2 );
if( buf == NULL )
return NULL;
b_error |= fread( buf, 1, i_size, fh ) != i_size;
if( buf[i_size-1] != '\n' )
buf[i_size++] = '\n';
buf[i_size] = 0;
fclose( fh );
if( b_error )
{
x264_free( buf );
return NULL;
}
return buf;
}

kemuri-_9
23rd January 2009, 14:33
i created a quick .avs file to pass to x264 with the stats so that it would scan the .stats


Blankclip(width=240,height=160,length=1237903,pixel_type="YV12")
AssumeFPS(2997,50)



avis [info]: 240x160 @ 59.94 fps (1237903 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSEMisalign LZCNT
x264 [warning]: VBV maxrate specified, but no bufsize.
x264 [warning]: direct=auto not used on the first pass
x264 [info]: profile Baseline, level 1.3
mp4 [info]: initial delay 0 (scale 2997)


and then it proceeded to encode.
so the problem could be
A. you moved your .stats without realizing
B. your computer is horrible and failed the malloc's request for memory in the above mentioned function by Dark Shikari.

also:
since there are no special characters in your filenames, you don't need to wrap them in ""
but this should just be an aesthetic thing.

njahnke
23rd January 2009, 23:24
thanks guys. after scratching my head for a while i tried copying the stats file to another volume (this one local to the encoding machine) and it worked - after hanging for almost 60 seconds. my guess is that when it's on my nas as it was originally, some timeout is closing the file before it can read the whole thing so then b_error gets set. i've had some problems like this before with my nas, like using the old school bsd ftp client to upload files from it, sometimes it gets an i/o error because it timed out trying to read the file. at any rate this obviously isn't a problem with x264, so i apologize for wasting your time.

also kemuri: yeah, the reason the quotes are there is that it's actually the output of a script, and i like to be careful when i write scripts in case something sneaks into one of the arguments.