View Full Version : Help, x264 drops frames
fakey
20th June 2006, 16:55
Recently noticed my x264 encodings are slightly shorter than source clip.
So I did a small test with simple avs script like this.
BlankClip(length=200, width=320, height=240, fps=29.970, color=$000000)
showframenumber()
converttoyv12()
And command line goes as simple as this
x264.exe -o test.mkv test.avs
x264 console output says
avis [info]: 320x240 @ 29.97 fps (200 frames)
x264 [info]: using cpu capabilities MMX MMXEXT SSE 3DNow!
x264 [info]: slice I:1 Avg QP:23.00 size: 6933 PSNR Mean Y:47.70 U:46.51
V:47.52 Avg:47.45 Global:47.45
x264 [info]: slice P:199 Avg QP:26.00 size: 1441 PSNR Mean Y:44.82 U:44.17
V:45.12 Avg:44.73 Global:44.67
x264 [info]: mb I I16..4: 80.7% 0.0% 19.3%
x264 [info]: mb P I16..4: 0.2% 0.0% 2.2% P16..4: 0.4% 0.4% 2.5% 0.0% 0
.0% skip:94.2%
x264 [info]: PSNR Mean Y:44.839 U:44.182 V:45.127 Avg:44.747 Global:44.685 kb/s:
352.12
Seems all fine.
But the output file has only 149frames instead of 200frames.
And the last frame looks like this.
http://img148.imageshack.us/img148/6591/lastframe0ek.png
I am using Sharktooth's r532A CLI and also got similar problem with CelticDruid's.
(Tested CelticDruid's down to r286, number of dropped frame was slightly different but the problem was always there.)
I'm using AMD AthlonXP 2500(no overclock!), WindowsXP SP2, Avisynth 2.56(tried 2.57 with no success).
Also opened the same script with VirtualDub and tried XviD encode, went fine, from 0 to 199 every single frame was there.
Tried mp4 output -> broken file
Tried .264 output -> less framdrop but problematic
Tried mencoder -> fine
Tried 2000frames -> 1951frames
Any kind of advice will be appreciated.
Inventive Software
20th June 2006, 17:05
AFAIK x264 commandline app doesn't like NTSC frame rates, or any sort of floating point numbers as frame rates. Try 25 FPS and see what happens.
Sharktooth
20th June 2006, 17:14
That issue was fixed centuries ago.
The MP4 it produces is NOT broken. You just need to update your software coz it contains 64bits timestamps.
Also avisynth produdes bad (very high) dwscale and dwrate values. In version 2.57 it's fixed.
In conclusion, that's not a x264 problem.
fakey
20th June 2006, 17:27
I don't think 29.970 is wierd fps number but results anyway.
2000frames at 25fps -> 1967frames
@Sharktooth
I've got MPC and Celtic's mplayer dated June15th and both can't play the output file.
Which software should I use to play the mp4?
Sharktooth
20th June 2006, 17:45
mplayer and MPC+Haali media splitter should be perfectly able to play it.
However i use 532A too and never experienced those problems.
fakey
20th June 2006, 17:57
Hmm, Tried to remux mp4 with yamb.
Yamb says "Error importing C:\test.mp4: IsoMedia File is truncated
"
Wierd.
Is x264.exe dependant on some dlls?
Because Mencoder and VDub works fine, I'm thinking my Windows may have got some kind of unwelcomed dlls.
bond
20th June 2006, 19:07
as you wrote in your first post you also get dropped frames with mkv, so it doesnt seem to be a mp4 problem
i kinda get the feeling something is broken on your side, try jarods svn builds too
fakey
21st June 2006, 08:27
Yeah, It's obvious that something on my side is broken since other guys don't suffer the problem.
But the thing is how could I solve the problem?
Tried to get the point as narrow as possible but no luck so far.
Looking at file handle, replaced msvcp60.dll and msvcrt.dll with fresh ones.
Still getting truncated output.sigh
edit:typo
GodofaGap
21st June 2006, 09:19
Did you try to update to the latest avisynth?
fakey
22nd June 2006, 07:07
Yes, I tried Avisynth2.56 and 2.57alpha and both came out with the same result.
However it's hard to say Avisynth is guilty because mencoder and Vdub are encodiing alright with the same script.
Inventive Software
22nd June 2006, 11:07
i kinda get the feeling something is broken on your side, try jarods svn builds too
By this I think he meant the x264 exe. Try re-downloading it, then replacing the exe with the fresh one.
fakey
22nd June 2006, 13:33
I've downloaded SharkTooth's r532A 3 times, and dozens of Celtic Druid's various revision as I wrote in my first post.
No error detected extracting from 7z files, so it's quite safe to say nothing like data curruption occurred during downloads.
GodofaGap
22nd June 2006, 13:46
Perhaps a weird question, but is the filesize of the testclip consistant with the bitrate?
6.6 seconds at 352 kbps should give you something around 290 KB. I'm just wondering because mp4box says your file is truncated...
emmel
22nd June 2006, 14:44
I just made a test, and was able to reproduce your results (post #1) with the internal Matroska splitter of MPC. No replay problems with the Haali splitter, nor with mplayer or VLC, though. Have you tried raw output and mplayer or vlc? (x264 -o test.264 test.avs)
fakey
22nd June 2006, 14:48
200frames results 352.26kb/s 149frames 216KB
200frames --bitrate 200 results 205.23kb/s 149frames 128KB
200frames --bitrate 500 results 490.47kb/s 150frames 300KB
2000frames results 351.99kb/s 1951frames 2.75MB
2000frames --bitrate 200 results 200.89kb/s 1947frames 1.5MB
2000frames --bitrate 500 results 500.20kb/s 1950frames 3.9MB
So, truncating occurs for the last 50 or so frames and truncating point is not constant.
GodofaGap
22nd June 2006, 14:48
I have no problems with MPC's internal splitter here, and it wouldn't explain the truncation error given by mp4box, nor the inability to play it correctly with mplayer.
[edit]
so it appears the files don't appear to be finished correctly, all your files are too small... have you tried another harddisk or partition? (if available). Also try to disable any virusscanners that do active scanning when writing, sometimes these give problems too...
fakey
22nd June 2006, 15:03
I don't use any virus scanner.
And if my harddisk is the problem, how could mencoder or vdub write flawless output file?
I know it looks wierd, i feel the same.
But none of other tools have any problem, x264.exe is the only one truncating here.
emmel
22nd June 2006, 15:11
Also with raw output, if you skip the muxers?
fakey
22nd June 2006, 15:41
Sorry, I missed your post.
Finally someone could reproduce the problem.:sly:
Raw output cuts out less frames but still not all of the frames are preserved.
200frames results 198 frames
2000frames results 1997frames
mplayer does not show the last frame, in MPC(muxed in mp4) last frame looks like this
http://img220.imageshack.us/img220/1673/x264rawoutput3wp.png
emmel
22nd June 2006, 16:52
Finally someone could reproduce the problem.
Actually, I do get the correct output from x264 in all formats - 264, mkv, and mp4. The problem is that my mpc+decoder can only seek through frames 1-149 of the mkv like in your first example. Other proggies and splitters perform ok also in this case.
Your problem begins to sound like a strange io-problem to me... unflushed buffers, or something... can you verify the performance with another comp?
fakey
22nd June 2006, 17:31
Naaah, I'm getting the same results in MPC and mplayer.
Unflushed buffers? Sounds possible.
What do you mean by 'verify the performance with another comp'?
My sister's computer have similar components like AthlonXP, WinXP SP2, tested the same script, worked flawlessly.
bond
22nd June 2006, 19:46
didnt i already say that you should try jarod's build (x264.nl) which isnt including experimental patches?
foxyshadis
22nd June 2006, 21:01
"mkvverify (http://www.alexander-noe.com/video/mkvverify/) -summary" tells you how many frames are in an mkv file. That way you can tell for sure whether the error is x264 or MPC (haali's splitter?).
mp4box has something like it but I don't remember the syntax.
Sharktooth
22nd June 2006, 22:59
no frame drops here... tested with several sources with several encoder options and several different framerates...
fakey
23rd June 2006, 01:41
@bond
jarod's r532 gave me the same results
200frames resulted 352.26kb/s 149frames
2000frames resulted 351.99kb/s 1951frames
@foxyshadis
I'm already using mkvverify -fullcheck -summary.
Made batch file and registered it in explorer's context menu.
Forgot to mention it but all frame count (except mp4 and raw output) was measured by mkvverify.(and confirmed with MPC and mplayer dated june15)
@sharktooth
Your compile is not the only one producing problem and my computer is the only one experiencing problem for now.
So no compile issue here.
Sharktooth
23rd June 2006, 01:50
Can we suppose to exclude overclock and RAM modules problems?
fakey
23rd June 2006, 02:03
I'm not overclocked and not experienced RAM problem either.
Truncating point slightly varies with encoding options but for the same options ten times of encoding produces the same truncating point.
If the problem have been occurred in arbitrary point, I would be with you doubting suspicious hardware problem. But it's not.
Carpo
23rd June 2006, 08:16
i have had a simular issue like this (not with x264 tho) the program i used to make the "test clip" was to blame - it did not cut the sample quite right and this ended up causing xvid to kick out, poss this is what is happening here ?
fakey
24th June 2006, 18:37
I am using only avisynth script and command line encoder, no GUI here.
So my problem is not the same one as you experienced.
Anyway thanks for the advice.
Think I should use mencoder for some time.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.