Log in

View Full Version : Problem with H264StereoSource (x264 crashes, right eye stream broken)


GrandAdmiralThrawn
3rd March 2013, 15:30
Greetings!

I have once successfully encoded a 3D Blu-Ray (the movie "Prometheus") to a Half-SBS 3D MKV, using the H264StereoSource.dll plugin for AviSynth 2.5.8. And now I can no longer reproduce what I did, x264 just crashes on me. This time I am trying the movies "Paranorman 3D" and also the "Abraham Lincoln - Vampire Hunter 3D" thing.

I use BDtoAVCHD to extract the elementary streams (it's basically just eac3to at work), and then the tool writes an AviSynth script for me. Looks somewhat like this (I edited a bit before posting, so the paths and filenames are not the actual ones):


LoadPlugin("C:\Program Files (x86)\VFX\BDtoAVCHD\H264StereoSource\ffms2.dll")
LoadPlugin("C:\Program Files (x86)\VFX\BDtoAVCHD\H264StereoSource\H264StereoSource.dll")
FFIndex("D:\left.h264", cachefile="D:\left.index", demuxer="lavf")
left = FFVideoSource("D:\left.h264", cachefile="D:\left.index", seekmode=-1).AssumeFPS(24000,1001)
right = H264StereoSource("D:\crash.cfg", 132566).AssumeFPS(24000,1001)
return StackHorizontal(HorizontalReduceBy2(left), HorizontalReduceBy2(right)).Trim(0, 132516)


I also tried with DGAVCDecode instead of FFMS2, just to see whether this is the problem (it was not), the dga file has been created with DGAVCIndex:


LoadPlugin("C:\Program Files (x86)\VFX\AviSynth 2.5\plugins\DGAVCDecode.dll")
LoadPlugin("C:\Program Files (x86)\VFX\BDtoAVCHD\H264StereoSource\H264StereoSource.dll")
left = AVCSource("D:\left.dga")
right = H264StereoSource("D:\crash.cfg", 132566).AssumeFPS(24000,1001)
return StackHorizontal(HorizontalReduceBy2(left), HorizontalReduceBy2(right)).Trim(0, 132516)


And here is the crash.cfg file for right eye stream decoding:


InputFile = "D:\left.h264"
InputFile2 = "D:\right.h264"
FileFormat = 0
POCScale = 1
DisplayDecParams = 1
ConcealMode = 0
RefPOCGap = 2
POCGap = 2
IntraProfileDeblocking = 1
DecFrmNum = 0


Now, this runs for a few seconds, and then x264 crashes. But even before it crashes, it's pretty obvious that it's not working properly. The decoding of the right eye stream produces the following output in the console, before the crash:

http://www.xin.at/thrawn/pics/screenshots/x264/x264-3d-crash-1.png

Until then, the transcoder will have produced a small output file. If I mux that output to an MKV and try to play back, I get the following (I also get this when trying to play back the Avisynth script directly), click to enlarge please:

http://www.xin.at/thrawn/pics/screenshots/x264/x264-3d-crash-2_small.jpg (http://www.xin.at/thrawn/pics/screenshots/x264/x264-3d-crash-2.jpg)

There are artifacts even in the left eye stream, but the right eye one is completely fucked up, as you can clearly see.

I have not updated, nor changed my AviSynth and BDtoAVCHD setups, only x264 has been updated. But I tried this even with older x264 versions just now, producing the same problem (also, the x264 version bundled with BDtoAVCHD does the same thing).

I know that these errors come from the H264StereoSource specifically, because I tried to change the avs script to only decode right eye, like this:


LoadPlugin("C:\Program Files (x86)\VFX\BDtoAVCHD\H264StereoSource\H264StereoSource.dll")
H264StereoSource("D:\crash.cfg", 132566).AssumeFPS(24000,1001)


And it produces the same problem. Doing an FFVideoSource or AVCSource on the left eye stream only, everything works just fine, and I get proper 2D output.

Here is my command line for x264, encoding a first pass, usually a 2nd one would follow as I'm aiming for a specific target file size, this is a 32-Bit x264 with 8-bits per channel color depth (matching my 32-Bit AviSynth):

x264.exe --preset veryslow --tune film --b-adapt 2 --b-pyramid normal -r 3 -f -2:0 --bitrate 8000 --aq-mode 1
-p 1 --slow-firstpass --stats movie.stats -t 2 --no-fast-pskip --cqm flat --non-deterministic input.avs -o pass1.264

I'm clearly doing something wrong. I just have no idea what it is. This worked once, and somehow I broke it or I forgot something, but I simply can't figure out what it is.

Please, help!

Thanks!

GrandAdmiralThrawn
4th March 2013, 18:17
Nobody has an idea?

Any alternative to the H264StereoSource plugin that I might try instead?

Sharc
4th March 2013, 19:53
Already tried this (http://forum.doom9.org/showthread.php?p=1609310#post1609310) ?

http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z

GrandAdmiralThrawn
5th March 2013, 19:23
I wasn't aware of this tool. Ok, it gives me another avs script using ssifSource2().

However, on the line where ssifSource2() is being called, I get this error:

avs [error]: Can't create the graph
(_ENCODE_3D_MOVIE.avs, line 2)
x264 [error]: could not open input file `_ENCODE_3D_MOVIE.avs'

Here's the filter graph for that avs:

http://www.xin.at/thrawn/pics/screenshots/x264/x264-3d-crash-3.png

I'm getting desperate... I do not understand the error, would be nice if Avisynth was a little bit more verbose.. I checked the paths and all in the avs, but everything is correct. Also the environment variables that BD3D2MK3D makes its encoding script generate where set correctly. I just don't get it.

Rumbah
5th March 2013, 20:20
For opening the avs file your program calling it (e.g. x264) must be in the stereoplayer.exe folder. Anything else does not work.

GrandAdmiralThrawn
5th March 2013, 20:44
Thanks! I just found that out myself a few seconds ago, I was calling x264 from another folder. Got it now. :)

It is finally working, now I just hope what I'll get is a working Half-SBS output, but I've now got a good feeling about this.

Edit: I copied my 1st pass output out of the running encoding process for previewing, muxed it to mk3d, and it's looking good! I don't have access to any 3D display right here, but at least both the left eye and right eye streams look ok!

Edit 2: For some movies I do get "frame duplicate added" for every single encoded frame, but the frame count seems to be fine at the end, and the output looks ok (only got 1 complete sample for now, trying another one right now). Strangely, there was another movie that I transcoded (Madagascar 3 3D), that did not show any such duplicate frames. Weird. But at least it seems to produce good output! :)