Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
I don't have a iPod yet, so I have been relying on the eye and judgement of others, all of whom have been happy with the results. I am not a programmer or someone interested in spearheading changes to applications already out there, if you have a favorite app, forward this thread to the author and see what happens.

I WILL NOT ANSWER NON-TECHNICAL QUESTIONS ABOUT THESE APPS OR WHAT I HAVE DONE. So don't ask me to help you unless you know what you are doing already!

My goal was to create high quality video that looked GOOOOOOOOD when hooked to a TV, somewhere between broadcast and DVD quality while keeping the bitrate to a reasonable ammount. Secondary is the quality when viewed on the iPod screen. It looks like that "reasonable" ammount is falling into the range of 9-13mb/minute ( VCD bitrates ). You can go lower, but you will loose quality in some scenes, but not all.

I was working under windows, but the main tool used was ffmpeg and that should be availible for about every OS known to man at this point. Specifically I was using the ffmpeg from pspvideo9. For pre-conversion scaling and cleaning I used AviSynth. Because of some weird reason ffmpeg won't do 23.976 ( rounds up to 23.98 and that leads to audio sync issues ). So my Avisynth did an AssumeFPS and rescaled the audio to match. I also allplies light spatial and temporal smoothing to reduce the very high levels of grain in this particular movie. I then did a very simple 2-pass encode in ffmpeg. I have tried and tried to play with more advanced settings with ffmpeg, but nothing really resulted in higher quality. Tron is, IIRC, 2.05:1 so i trimmed it down to 2:1 and scaled it to 640x320 for my testing. One technical note was I converted to RGB before scaling as this lead to fewer problems with color artifacts from scaling raw 4:2:0 color data.

First pass - standard

ffmpeg -i input.avs -vcodec xvid -vtag mp4v -vprofile SP -4mv -qscale 2 -pass 1 -passlogfile log -acodec aac -ab 96 -f mov out.mov

Second Pass - optimized for iPod

ffmpeg -i input.avs -vcodec xvid -vtag mp4v -vprofile SP -4mv -qmax 8 -bufsize 4096 -maxrate 2350 -b 1100 -pass 2 -passlogfile log -acodec aac -ab 96 -f mov out.mov

-b is the bitrate and I have had good luck setting it to ~ 1/2 the final average bitrate in the first pass. bufzise/maxrate is a precaution against VBR runaway.

And... drumroll please... here is the compression sample from Tron.

http://u2.rit.albany.edu/~ew2193/tron81.mov ( 20MB mov file )

More From "The Fifth Element"

http://u2.rit.albany.edu/~ew2193/tfe-pass2-1100.mov ( 23.3MB .mov 9.32MB/min ) - excellent

http://u2.rit.albany.edu/~ew2193/tfe-pass2-900.mov ( 19.6MB .mov 7.84MB/min ) - ok


ADMINS: This is a compression sample that cuts a dozen or so 300 frame chunks from the movie. I firmly believe this falls under "fair use" but I will pull the link if you feel otherwise.



APPLE: If you see this... please fix the Display Aspect Ratio (DAR) playbeck bug. If you do I can finally create broadcast quality video consistantly and within your specs! Thanks!

EDIT: Oct 25th 1:34pm EST Added -vtag mp4v to make sure that output will have a "conforming" FourCC code.
 

Lacero

macrumors 604
Jan 20, 2005
6,637
3
Hmmm.. does ffmpeg encode H.264?

I think scaling to 320x240 and then compressing will give the best results, as opposed encoding at a different size and allowing the iPod to scale dynamically. This results in lower sharpness and increased CPU usage.

I think Apple has the best settings, something like H.264 encoded at 600Kb/s or so. AAC 128Kbps stereo.

The iPod outputs TV at QVGA quality so the extra resolution is wasted, I believe.
 

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
Lacero said:
Hmmm.. does ffmpeg encode H.264?

I think scaling to 320x240 and then compressing will give the best results, as opposed encoding at a different size and allowing the iPod to scale dynamically. This results in lower sharpness and increased CPU usage.

I think Apple has the best settings, something like H.264 encoded at 600Kb/s or so. AAC 128Kbps stereo.

The iPod outputs TV at QVGA quality so the extra resolution is wasted, I believe.

1) Only for iPod only viewing, yet it's a waste. If you read my introduction the intent was focused on video that looked good on the TV out rather than on the screen.

2) Only for iPod only viewing

3) NO, it's already been shown to output higher quality.
 

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
cbiffle said:
Just out of curiosity, everyone has read Apple's info on the accepted formats?

Of course, but there are so many problems with that list... the fact of the matter it doesn't even play .mp4 files created from the reference tools, nor does it properly obey DAR and PAR issues in the files either ( ie works in QT, not on iPod dispite being a dirt simple change ). Those specs are inacurate and a joke. It will take time for the users to figure out what the device will really do, and what I have done is a first step.

This was targeted far high quality video out for the weekend warrior who wants to carry around a few DVD's far watching whereever he happens to be. Or for that great family video that you have authored, but don't want to cripple it by encoding it to 320x240 ( crap ).
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
cbiffle said:
Just out of curiosity, everyone has read Apple's info on the accepted formats?

http://www.apple.com/quicktime/tutorials/creatingvideo.html

Down at the bottom it's pretty specific about what will and will not work.

If you're on the Mac and have a lot of spare time (QT export to H.264 is sloooow) try my app Enpod.

It's really, really preliminary, but it works for me.

Awesome, thanks!!!
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
snowmoon said:
My goal was to create high quality video that looked GOOOOOOOOD when hooked to a TV, somewhere between broadcast and DVD quality while keeping the bitrate to a reasonable ammount. Secondary is the quality when viewed on the iPod screen. It looks like that "reasonable" ammount is falling into the range of 9-13mb/minute ( VCD bitrates ). You can go lower, but you will loose quality in some scenes, but not all.

I was working under windows, but the main tool used was ffmpeg and that should be availible for about every OS known to man at this point. Specifically I was using the ffmpeg from pspvideo9. For pre-conversion scaling and cleaning I used AviSynth. Because of some weird reason ffmpeg won't do 23.976 ( rounds up to 23.98 and that leads to audio sync issues ). So my Avisynth did an AssumeFPS and rescaled the audio to match. I also allplies light spatial and temporal smoothing to reduce the very high levels of grain in this particular movie. I then did a very simple 2-pass encode in ffmpeg. I have tried and tried to play with more advanced settings with ffmpeg, but nothing really resulted in higher quality. Tron is, IIRC, 2.05:1 so i trimmed it down to 2:1 and scaled it to 640x320 for my testing. One technical note was I converted to RGB before scaling as this lead to fewer problems with color artifacts from scaling raw 4:2:0 color data.

You did an awesome job, great test!!

I just played back on my iPod, it works great with no scaling artifacts and no skipping, etc. either.

I won't be able to play on a TV until tonite, but will compare this video with the episode of Lost I bought. This will confirm once and for all what will be possible. But it looks like H264 will be great for portable content, and MPEG4 will be great for TV output.

The video you made has excellent quality, with very few compression artifacts. I didn't look over it with a magnifying glass, but watched it fullscreen on my 15" PowerBook and it looks great. 10 Megabytes per minute, I think that will be the standard for creating iPod content for TV out... It's nice and easy to remember too.

It's only a matter of time before freeware programs are created on Mac and Win to rip DVD's to MPEG4 with settings similar to yours.
 

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
madmaxmedia said:
It's only a matter of time before freeware programs are created on Mac and Win to rip DVD's to MPEG4 with settings similar to yours.

That's half the reason for this thread. To give developers a starting point that is known to work well.
 

freeny

macrumors 68020
Sep 27, 2005
2,064
60
Location: Location:
the setting i found best for tv viewing are as followed;

using handbrake,
mp4
1100 kbps (ive set higher but not enough difference to justify file size increase)
2-pass encoding (makes a great difference and well worth the time!)
48000Hz
160 Bitrate.
480 widest pixel ratio (as long as hight or width dont exceed 480 pixels)

equals broadcast quality but just short of dvd.
8-9mb per minute

hope this helps.
 

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
freeny said:
equals broadcast quality but just short of dvd.
8-9mb per minute

hope this helps.

Making it 640xY means that you are only scaling it once in each direction vs 480xY you are scaling twice in each direction. Although most scenes will probably look ok, you are distroying fine detail. As soon as apple obeys the DAR flags you will be able to have MUCH more flexability in scaling, but until that time 640xY is the way to go.

Those are close to the setting I recommend except you don't have buffer overrun protection. If handbrake has an option to add options "-bufsize 4096 -maxrate 2200" will help make sure that this video does not skip on complex video.
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
freeny said:
the setting i found best for tv viewing are as followed;

using handbrake,
mp4
1100 kbps (ive set higher but not enough difference to justify file size increase)
2-pass encoding (makes a great difference and well worth the time!)
48000Hz
160 Bitrate.
480 widest pixel ratio (as long as hight or width dont exceed 480 pixels)

equals broadcast quality but just short of dvd.
8-9mb per minute

hope this helps.

That's another option, using 480 wide to save on storage. But I think VGA at 10MB per minute will be optimal. It just needs good encoding, as OP did.
 

freeny

macrumors 68020
Sep 27, 2005
2,064
60
Location: Location:
snowmoon said:
Making it 640xY means that you are only scaling it once in each direction vs 480xY you are scaling twice in each direction. Although most scenes will probably look ok, you are distroying fine detail. As soon as apple obeys the DAR flags you will be able to have MUCH more flexability in scaling, but until that time 640xY is the way to go.

Those are close to the setting I recommend except you don't have buffer overrun protection. If handbrake has an option to add options "-bufsize 4096 -maxrate 2200" will help make sure that this video does not skip on complex video.
I was not aware that you could go up to 640pixels. can you really do this on mp4? havent tried it.
 

Scarpad

macrumors 68020
Jan 13, 2005
2,135
632
Ma
freeny said:
the setting i found best for tv viewing are as followed;

using handbrake,
mp4
1100 kbps (ive set higher but not enough difference to justify file size increase)
2-pass encoding (makes a great difference and well worth the time!)
48000Hz
160 Bitrate.
480 widest pixel ratio (as long as hight or width dont exceed 480 pixels)

equals broadcast quality but just short of dvd.
8-9mb per minute

hope this helps.

to my knowledge two pass is only beneficial when you are using varable bit rate encoding. When specifying a bitrate it does that bitrate thruout, CBR Constant bitrate
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
freeny said:
DUDE! you just gave me a boner.

Wait til you download and watch the Tron clip. Play it fullscreen your computer...

Hey snowmoon, can you do a short rip from a more demanding movie? Althoug h the Tron clip has some regular shots, the CGI shots are probably less demanding.

Maybe something like 30 seconds from an action sequence in the Matrix, that's always a popular choice. I mean I can sorta do it, but I'm not that great at tweaking settings, etc. and I have been having problems getting ffmpegx to work right on my Mac.
 

snowmoon

macrumors 6502a
Original poster
Oct 6, 2005
900
119
Albany, NY
madmaxmedia said:
Wait til you download and watch the Tron clip. Play it fullscreen your computer...

Hey snowmoon, can you do a short rip from a more demanding movie? Althoug h the Tron clip has some regular shots, the CGI shots are probably less demanding.

Maybe something like 30 seconds from an action sequence in the Matrix, that's always a popular choice. I mean I can sorta do it, but I'm not that great at tweaking settings, etc. and I have been having problems getting ffmpegx to work right on my Mac.

I;ll try and find something... CGI is demanding in its own way. I will also upload a 25fps shot and a 4:3 encode... give me a few hours though since Im at work right now.
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
snowmoon said:
I;ll try and find something... CGI is demanding in its own way. I will also upload a 25fps shot and a 4:3 encode... give me a few hours though since Im at work right now.

Okay, cool! Hopefully I will be able to check out TV output with your Tron sample tonite, and will post impressions. From other posts I am almost positive that the higher-res will result in a great TV picture, but I want to confirm with my own eyes with your test material.

If you want to be extra sure of test results, you can do a 320 x 240 encode of the Tron sample for comparison. I will actually just be comparing to my downloaded episode of 'Lost'. On my PowerBook screen the difference during fullscreen playback is quite obvious, I am expecting similar results on a TV. Maybe not quite as obvious, but still noticeable difference.
 

freeny

macrumors 68020
Sep 27, 2005
2,064
60
Location: Location:
Scarpad said:
to my knowledge two pass is only beneficial when you are using varable bit rate encoding. When specifying a bitrate it does that bitrate thruout, CBR Constant bitrate
in handbrake it only says "average bitrate" weather its sticks to that i can only assume. all i know is that i did one version with 2 pass and one without. the one with 2 pass is very noticably better.
 

Scarpad

macrumors 68020
Jan 13, 2005
2,135
632
Ma
snowmoon said:
I;ll try and find something... CGI is demanding in its own way. I will also upload a 25fps shot and a 4:3 encode... give me a few hours though since Im at work right now.


I'd be interested in the resolution you will be using for your 4:3 encode.
 

madmaxmedia

macrumors 68030
Dec 17, 2003
2,932
42
Los Angeles, CA
freeny said:
just ripped a video using handbrake,
mp4
1100 kbps
2-pass encoding
160 Bitrate.
at 640x480

ipod refused it

what did i do wrong?

The only thing I can think of is that 640 x 480 may be too many pixels. It can for sure play back 640 x 320, which is the same number of pixels as 480 x 480.

Also, I assume you're using MPEG-4 Video codec, right?
 

freeny

macrumors 68020
Sep 27, 2005
2,064
60
Location: Location:
madmaxmedia said:
The only thing I can think of is that 640 x 480 may be too many pixels. It can for sure play back 640 x 320, which is the same number of pixels as 480 x 480.

Also, I assume you're using MPEG-4 Video codec, right?
correct.
so it may be a pixel ratio issue?
is this something that will only apply to widescreen ratios? ie 640x272?
only 230,400 pixels allowed?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.