Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
This was initially posted in "ask a question get an answer" but I felt it needed to be posted in a new topic now.
I don't know if my problem warrants a new thread, so here goes. I've been using x264 encoder lately - more precisely, a folder with these files that Abahbob gave me:
js32.dll
libgomp-1.dll
MP4Box.exe
mt_masktools-26.dll
mvtools2.dll
neroAacEnc.exe
pthreadgc2.dll
sox.exe
wget.exe
wget.ini
x264.exe
zlib1.dll
encode.bat
<other>
encode.bat contains:
x264 --crf 36 --ref 16 --bframes 6 --keyint 1000 --colorprim bt709 --transfer bt709 --output-csp rgb --output video.mp4 avs2.avs
pause
But I can't finish rendering a certain video because there appears to be some kind of memory leak in x264... or so I suspect, and google tells the same but I haven't been able to find a way to fix it with ease. My RAM gets used up more and more during the rendering process. If there's no more RAM available, a message pops up saying "x264 encoder stopped working". And in my latest try, it finished rendering but the last 3 minutes are cut off (I had to kill my internet, explorer, audio and a few others to get enough RAM for this - but now I don't know what to do). Is there a way to fix this problem, or is there a better way to encode videos easily than what I currently use? If needed, I can upload all the above files.
It turned out that videos encoded with the settings shown in the encode.bat would glitch out on Youtube. See this: http://www.youtube.com/watch?v=YFNJAAgkcqM (The video was dumped uncompressed RGB24, then I compressed it in lagarith lossless, and then I encoded it with x264). I'm worried about the loss of brightness in Luigi's green color. See here: https://twitter.com/mugg1991/status/273695358096379904/photo/1 (Lagarith lossless actually keeps it bright as in the original, it seems) So now I have already run out of options. I can't encode the video and keep Luigi's color bright at the same time. The '--output-csp rgb' made it so it keeps bright, but it somehow causes Youtube to glitch. What now? I hope someone can help...
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
It's probably avisynth that's leaking. Consider running avisynth in a separate process (like avs2pipemod). Youtube x264 uploads should always be 8 bit 4:2:0 yuv limited range. Lossy or lossless works. MP4 may work, but I've had best success with MKV. 601 vs 709 doesn't matter because it will be wrong no matter what.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
Consider running avisynth in a separate process (like avs2pipemod).
Youtube x264 uploads should always be 8 bit 4:2:0 yuv limited range.
601 vs 709
I don't understand any of this. Please explain it to me like I'm five. In the meantime, I got the package from here. But neither the 512kb option nor the Youtube HD option works. When I tried the 512kb option, I got an error saying that it wants zlib1.dll, so I grabbed it from the previous folder. Then I got these:
x264 [error]: malloc of size 1193984 failed
x264 [error]: x264_encoder_encode failed
When I initially tried the HD Youtube option it didn't work right away. After placing all the files from my previous folder, it does this:
(...)
x264 [error]: malloc of size 353894404 failed
x264 [error]: x264_encoder_open failed
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
It means that you're running out of memory. Those 512kb commands are way too much for big res. EDIT: This is the 709, what you should use on your HD script. Just copy it and paste it.
Language: avisynth

ConvertToYV24(chromaresample="point", matrix="Rec709") ConvertToYV12(chromaresample="point", matrix="Rec709")
MORE EDIT: This are the versions you must use for YouTube. 32bit: http://mirror01.x264.nl/x264/32bit/8bit_depth/revision2230/x264.exe 64bit: http://mirror01.x264.nl/x264/64bit/8bit_depth/revision2230/x264.exe
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
I replaced my x264.exe with the 32bit one. And I placed those two lines after the very last line in my avs. But the outcome it still the same.
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
Try this commands on X264:
x264 --qp 0 --keyint 250 --min-keyint 1 --range tv --colormatrix smpte170m -o video_youtube.mp4 encode.avs
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
Guga wrote:
Try this commands on X264:
x264 --qp 0 --keyint 250 --min-keyint 1 --range tv --colormatrix smpte170m -o video_youtube.mp4 encode.avs
This seems to prevent x264 from running out of memory. But it doesn't fix the darkened color mentioned here. Also the resulting mp4 would be a little over 1 GB which is borderline ok (I have yet to encode the full video). I wish it were closer to 700 MB or less. EDIT: The video is 1.78 GB which is not ok anymore. And It doesn't have any sound for some reason. Do you know how to fix the dark color? Thanks for the help so far.
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
The colors will be wrong on youtube no matter what you do. Even if you get something that looks correct on your computer. Youtube displays with different color matrices depending on all sorts of specifics of operating system, graphics card, and settings.
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
And about the size, you can change --qp 0 to --qp 10
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
-- Using the tasvideos encoding guide's scripts: I would still like to know why I cannot encode 512 or HD Youtube. How can I prevent those "run out of memory" messages? Perhaps I should use it with a raw video taken from the emulator rather than this 720p lagarith file. -- Audio missing For now I suspect it's some error in my avs or something. I'm busy, can't check it right now. EDIT: I can't find the problem. When the avs is opened in vdub, the audio is there. But after encoding it with x264, the audio is mute. EDIT: The 32bit x264 that Guga linked here does not produce any audio. I don't know why I didn't figure this out earlier. So I'm going to stick to the x264 I had. -- Youtube messes up the color regardless That's too bad... Does it also mess up the color if it is encoded with the tasvideos' guide's scripts? -- File size minimizing I will try.
Emulator Coder, Skilled player (1114)
Joined: 5/1/2010
Posts: 1217
MUGG wrote:
For now I suspect it's some error in my avs or something. I'm busy, can't check it right now.
You need to encode the audio separatedly (e.g. using venc) and mux it in using e.g. mkvmerge (part of mkvtoolnix).
MUGG wrote:
-- Youtube messes up the color regardless That's too bad... Does it also mess up the color if it is encoded with the tasvideos' guide's scripts?
It will mess colors up no matter what you do. The problem is follows: The display wants (and video camera spits out) the signal as red, green and blue intensities. Works very well for input/output of video signal. But, red, green and blue intensities doesn't work very well for video compression. Instead, normally for video compression, the signal is transformed into brightness, redness and blueness. The way the transformation between these two (Red,Green,Blue and Brightness,Redness,Blueness) is done is known as the color matrix. If the encoder and decoder are using the same matrix, the colors will come up correctly. Conversely, if the matrices do not match, the colors wil be incorrect. Now, what matrix does flash use? It depends on hardware, OS version, resolution and if playback is windowed or fullscreen. Thus, no matter what matrix you choose when encoding, it will be incorrect for some players. The video you did no doubt has correct colors for someone else (not just for you). If you encode it so it has correct colors for you, it will be incorrect for that somebody else.
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
Encoding is not easy and it will never be. :(
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
MUGG wrote:
Perhaps I should use it with a raw video taken from the emulator rather than this 720p lagarith file.
This line scares me. HOW did you manage to get lossless video of 720p in the first place?? Doesn't Manual say, dump lossless from emulator as described here?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
Ilari: Thanks, this clears up a lot of things. feos: I dumped it uncompressed. But when I experienced the memory leak and couldn't encode the video, I decided to splice all the video parts into one and compressed it with Lagarith. Probably it doesn't work well with the tasvideos guide scripts? In a crappy* test, using option 4 of the tasvideos encoding script (Youtube HD), I got this outcome: http://www.youtube.com/watch?v=78E0X0JINdU Luigi's green color is as bright as it should be. So, why didn't Youtube mess up the color in this video? ____ *the video seems to be lagging for me, probably because I'm watching too many livestreams
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
You said it was 720p. How did you get that at all? You must not be able to get that from the emulator for the platform you encode. The guide says you dump a losslessly compressed video and it's all, you give it to the script+x264.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
The video I linked in my previous post is what happened when I really gave it a lossless unchanged AVI. Everything prior to that, I used the said spliced file. I used avisynth to pointresize it and compressed it to Lagarith in virtualdub. I need to figure out how I can make the video that I originally wanted to make, by changing the tasvideos scripts around... At best, someone can point out why the color turned out correct in the linked video so I can just make use of that alone - without having to touch long complicated scripts.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Then what, you tried to compress the 720p video lossily? Wow, why do such comlicated things at all? If you ONLY need the Youtuber, dump losslessly, point-upscale lossily, and there you go. You can add the framerate reduction. Everything may be perfectly done in VirtualDub. Video - Filters - Add - resize - Filter mode - Nearest neigbour. New size - Relative - 400 Video - Frame Rate - Convert to fps - 30 or 25 Video - Compression - x264vfw - Configure: Preset -> Ultrafast Tuning -> Animation Rate control -> Single pass - ratefactor-based Ratefactor - 5 or 10. Zero latency must be checked! But this is not necessary, you can directly upload the upscaled vid you got to YT.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
Thanks for the help. I successfully encoded and uploaded my video, with the correct colors and no issues. I modified the tasvideos AVS to remove the deblinking and tasblend (because I think it makes things look ugly) and I output in 720p. I changed the BAT to be --qp 10 instead of 0 to minimize the file size a bit.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
Why would Deblink make it ugly?
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
It makes things appear blurred. http://i.imgur.com/o3AgO.png I'm not a fan of this.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
It happens only on previews. After actual encoding only the things that really blink become transparent. Try encoding that segment for test.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
That image is from the encode. And everything else that blinks also ends up like this. Such blending is good for games like Trip World where underwater sections make sprites flicker at 30 hz. Or for background graphics that flicker at 30 hz such as the doors in Kirby & The Amazing Mirror. But stuff that blinks or shakes for only a duration of 5 frames shouldn't be blended. But as said, it appears blended in the encode - I don't know what you mean by "it only happens in the preview".
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
The preview from VirtualDub.
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
Duh. But it doesn't only happen in the preview for me.