View Full Version : 1 pass works fine - 2 passes creates errors?
ect5150
31st August 2011, 04:39
Hey guys, I just wanted to check something with you.
I'm trying to encode a movie for my iPod. In meGUI, I use the playback target of iPod and the following settings:
program --profile baseline --level 3 --preset placebo --pass 2 --bitrate 360 --stats ".stats" --deblock 2:3 --min-keyint 1 --open-gop --ref 5 --vbv-bufsize 10000 --vbv-maxrate 10000 --rc-lookahead 250 --output "output" "input"
The problem is this- if I encode via a single pass, there is no problem with the output when I put it on the iPod. But if I encode with the same settings and do the automated 2 pass, the video on the iPod has errors (block noise, like the macroblocks are being moved around). Oddly enough, both file will play just fine on the PC (in either QuickTime or MPC-HC).
Thoughts? Comments? Questions? Thanks in advance for any input - or let me know if someone wants me to upload a file. I'm at a loss after my own testing.
nm
31st August 2011, 19:16
Which iPod model do you have? 10 Mbps VBV maxrate and bufsize are too much for the older generations at least.
ect5150
31st August 2011, 19:34
I need to check when I get home, but it is an older model. Although I thought I tried to lower the VBV Buffer Size and the VBV Maximum Bitrate to around 2500 to test.
Again, this works fine on 1-pass mode with the higher VBV settings, just not 2-pass.
nm
31st August 2011, 20:17
I need to check when I get home, but it is an older model. Although I thought I tried to lower the VBV Buffer Size and the VBV Maximum Bitrate to around 2500 to test.
That's probably also too high if you have a "classic" model. Try 768 for both.
Again, this works fine on 1-pass mode with the higher VBV settings, just not 2-pass.
There are probably higher bitrate spikes in the second pass encode with your source.
Dark Shikari
31st August 2011, 20:23
This likely has nothing to do with VBV and everything to do with a bug in the iPod decoder with reference reordering. I'll bet you that --preset veryslow has no such issue.
ect5150
31st August 2011, 20:31
That's probably also too high if you have a "classic" model. Try 768 for both.
Yeah, it's an older 'classic iPod' - 80 Gig model.
There are probably higher bitrate spikes in the second pass encode with your source.
Re-encoded it with no luck. I should note I have another older encoded video I did about a year ago or so and MediaInfo reports that video as having a maximum bitrate of 1,138 Kbps where the average bitrate was 230 Kbps. The command line with the older video (which works fine) has the following settings: vbv_maxrate=2500 / vbv_bufsize=2000.
Any other suggestions?
ect5150
31st August 2011, 20:43
This likely has nothing to do with VBV and everything to do with a bug in the iPod decoder with reference reordering. I'll bet you that --preset veryslow has no such issue.
Tried --preset veryslow, still the same errors.
Tried --preset ultrafast just now. That fixes the issue. I guess I'll go through a process of elimination and see which preset causes the errors and post the info later tonight.
Since we are on the topic... I noticed the video doesn't display black levels correctly (black bars on encoded on the video from the BluRay, and they stand out... in a similar fashion to some videos created from DVDs where the luminance isn't using a full 0-255 range). Any ideas on how to encode this differently for the iPad (again, proper levels works fine on the PC)
ect5150
31st August 2011, 22:28
Okay... here's what I found. Encoded my small clip by just moving the preset and made 10 small encodes. All encodes from MEDIUM up to PLACEBO gave errors... presets from FAST down to ULTRA FAST gave NO errors.
I then moved the preset to FAST and altered other settings as follows:
program --profile baseline --level 3 --preset fast --pass 2 --bitrate 360 --stats ".stats" --slow-firstpass --deblock 2:3 --min-keyint 1 --open-gop --weightp 2 --vbv-bufsize 10000 --vbv-maxrate 10000 --rc-lookahead 250 --merange 24 --me tesa --subme 11 --trellis 2 --no-fast-pskip --output "output" "input"
The above worked when I moved some of the settings back up (such as motion search) but left the slider on FAST. I'm not sure what else is going on that I'm not seeing though.
Any input just for knowledge sake?
ajp_anton
31st August 2011, 23:12
Just try everything that differs between fast and medium?
Fast = medium + [--rc-lookahead 30 --ref 2 --subme 6 --weightp 1]
ect5150
3rd September 2011, 14:25
Just try everything that differs between fast and medium?
Fast = medium + [--rc-lookahead 30 --ref 2 --subme 6 --weightp 1]
Well, the problem seemed to be the --ref 2. I bumped things back up to placebo with --ref 2 and my small clip played just fine.
Of course, when I encoded the entire movie with the same settings, it wouldn't even load onto the iPod :confused:
Blue_MiSfit
5th September 2011, 23:22
Regarding the black levels, using 16-235 is the standard. If you get grey looking mattes, that means your iPod is not using the correct color matrix when converting from YV12 into RGB for display. Unfortunately, there's nothing you can do on the iPod side of things.
You can kludge your encodes by adding something like ColorYUV(levels="TV->PC") to your AviSynth script. This is a brutal solution, but it should make things look correct on a hardware device like this where you have little to no control over playback.
Derek
ect5150
6th September 2011, 14:28
You can kludge your encodes by adding something like ColorYUV(levels="TV->PC") to your AviSynth script. This is a brutal solution, but it should make things look correct on a hardware device like this where you have little to no control over playback.
Thanks, that's exactly what I was looking for - I haven't had time to fool with it lately (last time, the entire encode wouldn't load - even if the smaller clip did.... I've got to solve that as well).
Thanks for the help.
Blue_MiSfit
7th September 2011, 04:12
No problem :)
I've had to do similar fuckery for certain software players. It makes me feel dirty inside, but it does work.
One hint - try SmoothLevels (needs a few plugins etc) instead of ColorYUV. It does a much nicer job of interpolating the missing values. Compare the two functions using histogram() like this:
a=coloryuv(levels="tv->pc").subtitle("coloryuv")
b=smoothlevels(preset="tv2pc").subtitle("smoothlevels")
interleave(a,b)
histogram
Drop that in avsp or virtualdub or whatever (plus loading a source at the head of course) and look at the histogram. It will be immediately obvious :)
Derek
ect5150
12th September 2011, 22:16
I give up! As usual, I come to the forums and get expert help (by the way, thanks again guys... these really are some of the best forums on the net) - but I can't get my full video to play on my iPod.
Everything you guys helped with up above allowed me to get small clips loaded to play correctly, to play with the correct black levels (small clips here being about 2000 frames).
But when I use the same settings to encode the whole movie, it won't even load on the iPod. I brought everything down, Ultra Fast settings, level 1.3, 768 buffer size - but nothing will even load on the iPod.
Edit: By the way, I had never seen avsp... I've been doing everything by hand in Context - avsp looks to be a godsend!
b66pak
13th September 2011, 18:16
get a recent build of mp4box from here (http://kurtnoise.free.fr/mp4tools/) and run this line (replace non-working with the name of your file):
mp4box -info non-working.mp4 > log.txt
post the content of log.txt here...
_
ect5150
13th September 2011, 21:35
get a recent build of mp4box from here (http://kurtnoise.free.fr/mp4tools/) and run this line (replace non-working with the name of your file):
mp4box -info non-working.mp4 > log.txt
post the content of log.txt here...
_
Here you go:
* Movie Info *
Timescale 600 - Duration 02:32:13.325
Fragmented File no - 1 track(s)
File Brand avc1 - version 0
Created: GMT Sun Sep 11 03:12:56 2011
File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: No audio capability required (0xff)
No streams included in root OD
Track # 1 Info - TrackID 1 - TimeScale 10000000 - Duration 02:32:13.325
Media Info: Language "Undetermined" - Type "vide:avc1" - 218981 samples
Visual Track layout: x=0 y=0 width=320 height=180
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 320 x 180
AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 1.3
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 320 x 180
Self-synchronized
b66pak
14th September 2011, 18:10
to fix this file use mp4fpsmod (http://forum.doom9.org/showthread.php?t=161386) with this line:
mp4fpsmod -c -o working.mp4 non-working.mp4
in order to propose a permanent solution to your problem i need to know what type of input are you using in your command line : file (.mkv, etc) or .avs...
if you input is a file then add this to your encoding line:
--timebase 1/1000
if your input is a .avs then you need to post its content here...
_
ect5150
14th September 2011, 20:02
if your input is a .avs then you need to post its content here...
_
Uh oh! I deleted the whole working directory a few days ago :p
But it would have been something similar to the following:
DirectShowSource(".\graph.grf", audio=false)
spline36resize(320,180)
If you want me to try and replicate it to double check, let me know. But it was a graph edit file coming in through AVS with some simple form of resize at the tail end.
b66pak
14th September 2011, 20:42
it should be like this:
DirectShowSource(".\graph.grf", audio=false, fps=23.976, convertfps=true).AssumeFPS(24000,1001)
spline36resize(320,180)
you should change the blue values according to your needs...
_
ect5150
14th September 2011, 21:34
it should be like this:
DirectShowSource(".\graph.grf", audio=false, fps=23.976, convertfps=true).AssumeFPS(24000,1001)
spline36resize(320,180)
you should change the blue values according to your needs...
_
I used to have those values in the script. But I removed them after I posted a script here a few weeks ago and got lambasted over those settings, claiming "they shouldn't be needed and will only mess things up if you're wrong."
I'll give it another shot semi-soon and post back later. Thanks for the help.
But should those settings make a difference for short clips versus the full length clip? Like I mentioned before, small clips play fine.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.