SageTV Community  

Go Back   SageTV Community > SageTV BETA Release Products > SageTV Beta Test Software
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Beta Test Software Discussion related to BETA Releases of the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. regarding SageTV Beta Releases should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-15-2006, 10:05 AM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Xvid transcoding and -aspect ratio.

I'm using a custom XviD profile to crop and transcode, but -aspect doesn't seem to have any effect when using the XviD 41 encoder.

It works perfectly with the default mpeg4 avi profiles, but not at all with XviD. Does the -aspect setting just not work with XviDs or am I missing something? I'm currently having to resize the video to 640*480 then crop. It would be much better if I could just crop and set the aspect ratio.
Reply With Quote
  #2  
Old 11-15-2006, 02:59 PM
Patilan Patilan is offline
Sage Advanced User
 
Join Date: Oct 2006
Location: Lake Forest, Illinois, USA
Posts: 237
It would help if you post the exact command line from your sage.properties file.
Reply With Quote
  #3  
Old 11-16-2006, 08:44 AM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Here is what I've been using. I'm a complete newb at transcoding. It looks decent enough for what I'm using it for, but I'm sure it isn't great. The first one gives me a 624x352 video with a QF of around 0.226. Quality seems to be reasonably close to the original considering.

Code:
transcoder/formats/Xvid\ 16x9\ Cropped\ &\ Deinterlaced\ AVI=f\=avi;MCompressionDetails\=-croptop 64 -cropbottom 64 -cropleft 8 -cropright 8 -deinterlace;[bf\=vid;f\=xvid;br\=1500000;w\=640;h\=480;arn\=4;ard\=3;][bf\=aud;f\=mp3;sr\=48000;ch\=2;br\=96000;]

The next one gives me a resolution of 624x464 and QF of 0.219. About the same quality as the 16x9 profile.

Code:
transcoder/formats/Xvid\ 4x3\ Cropped\ &\ Deinterlaced\ AVI=f\=avi;MCompressionDetails\=-croptop 8 -cropbottom 8 -cropleft 8 -cropright 8 -deinterlace;[bf\=vid;f\=xvid;br\=1900000;w\=640;h\=480;arn\=4;ard\=3;][bf\=aud;f\=mp3;sr\=48000;ch\=2;br\=96000;]

This one works fine for cropping and changing the aspect ratio without resizing:

Code:
transcoder/formats/MPEG4\ Cropped\ &\ Deinterlaced\ AVI=f\=avi;MCompressionDetails\=-vtag xvid -croptop 64 -cropbottom 64 -cropleft 8 -cropright 8 -deinterlace -aspect 16\:9;[bf\=vid;f\=mpeg4;br\=2000000;][bf\=aud;]


If I add -aspect 16\:9 to the XviD profiles it doesn't seem to have any effect. I've tried removing the resizing and -arn -ard so that the two profiles are as close to the same as possible, but it still doesn't work. For example the following seems to totally ignore -aspect:

Code:
transcoder/formats/Xvid\ 16x9\ Cropped\ &\ Deinterlaced\ AVI=f\=avi;MCompressionDetails\=-croptop 64 -cropbottom 64 -cropleft 8 -cropright 8 -deinterlace -aspect 16\:9;[bf\=vid;f\=xvid;br\=1500000;][bf\=aud;f\=mp3;sr\=48000;ch\=2;br\=96000;]
It would be nice to be able to set the aspect ratio, but after playing around some yesterday I think I'll probably still want to resize because the bitrate can be lowered quite a bit more without losing that much quality.

BTW it uses XviD build 41 to encode, if that matters.

Last edited by blade; 11-16-2006 at 09:14 AM.
Reply With Quote
  #4  
Old 11-16-2006, 04:16 PM
mayamaniac's Avatar
mayamaniac mayamaniac is offline
Sage Icon
 
Join Date: May 2004
Posts: 2,177
Thanks for posting these. I'm dealing with mainly normal recordings, which are 4:3 ratios. I noticed you are converting 16:9 sources, what would I need to change to make use of these profiles for 4:3 sources? Is there a manual or list of commands options and explanation of what each does? I would experiment with it myself if I know the correct usage format and options for SageTranscoder/FFMpeg.exe.
__________________
Mayamaniac

- SageTV 7.1.9 Server. Win7 32bit in VMWare Fusion. HDHR (FiOS Coax). HDHR Prime 3 Tuners (FiOS Cable Card). Gemstone theme.
- SageTV HD300 - HDMI 1080p Samsung 75" LED.
Reply With Quote
  #5  
Old 11-16-2006, 04:49 PM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Actually they are for use on 4:3 recordings I just named it 16x9 because that is what the finished avi will be. One crops letterboxed 4:3 so that it fits a 16:9 screen and the other is for standard 4:3 recordings and keeps the 4:3 ratio. The first two are the only ones I'm using the other two were just to show an example of using and trying to use -aspect to change the aspect flag.

I'm resizing the 720x480 (actual capture resolution of regular analog cable made with a PVR500) to 640x480 (what it should play back at). If -aspect worked for XviD I could simply crop without resizing and the video would playback at the proper ratio instead of the ratio of the resolution. It would speed up the transcoding, but would also require a higher bitrate to maintain the same quality so for my purposes I think resizing might be the best option anyway.

The first one I posted is for letterboxed 4:3 content. It will resize the 720x480 capture to 640x480 and crop the small black bars from the sides and the large bars off the top and bottom leaving you with a 624x352 16:9 video that should fit a 16:9 screen when played back in Sage.

The second one resizes the 720x480 capture to 640x480 and crops all 4 edges by 8 pixels each to remove the small black bars, closed captioning data, and other artifacts that tend to show up around the edges of the video. It will leave you with a 624x464 video (4:3 video).

I use these on shows that I don't intend to watch for quite some time and even then only when I start to run low on space. I converted 112 gigs of CSI Miami down to 32 gigs without losing too much quality. I know with other tools and better codecs they could have gone much lower, but being able to just select it in Sage and press a button makes it worth it to me.

Last edited by blade; 11-16-2006 at 06:39 PM.
Reply With Quote
  #6  
Old 11-16-2006, 07:16 PM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
As for the correct format and options I'm just shooting in the dark. I looked at the other default profiles and sort of guessed as to what I should use. I'm not sure if this is what you were wondering or not, but here is what little I know.

The following profile will transcode either 4:3 or 16:9 to XviD without any resizing or cropping. It will maintain the original resolution of the video.

Code:
transcoder/formats/Xvid=f\=avi;MCompressionDetails\=-deinterlace;[bf\=vid;f\=xvid;br\=1500000;arn\=4;ard\=3;][bf\=aud;f\=mp3;sr\=48000;ch\=2;br\=96000;]
The problem is I can't figure out how to get it to set an aspect ratio with XviD. So it will playback at whatever resolution the avi is if you choose source in Sage. So for example 4:3 video will playback incorrectly at 1.5:1 instead of 1.33:1; however, if you select 4:3 as the aspect ratio in Sage it will play back correctly. Basically it's not setting an aspect flag and goes strictly by resolution unless you specify the ratio during playback.

If you want to crop the small black bars around the edges just add back the -croptop -cropbottom ect... the numbers are the number of pixels you intend to crop. For best compression you want to keep the final horizontal and vertical resolution at multiples of 16.

If you want to resize the video so that it plays back at the correct aspect ratio when using source and be able to lower the bitrate some just add back w\=640;h\=480; set it to whatever you want the avi's resolution to be. Just remember though if you plan to use source as the aspect ratio you'll need the resolution to be the proper aspect ratio.

The target bitrate is pretty obvious br\=1500000

Last edited by blade; 11-16-2006 at 07:24 PM.
Reply With Quote
  #7  
Old 11-19-2006, 05:34 PM
Patilan Patilan is offline
Sage Advanced User
 
Join Date: Oct 2006
Location: Lake Forest, Illinois, USA
Posts: 237
Quote:
Originally Posted by blade
I'm resizing the 720x480 (actual capture resolution of regular analog cable made with a PVR500) to 640x480 (what it should play back at). If -aspect worked for XviD I could simply crop without resizing and the video would playback at the proper ratio instead of the ratio of the resolution. It would ... require a higher bitrate to maintain the same quality...
The above is simply incorrect. What's more, given an equal bitrate, a resized video will be definitely of lesser quality then the unresized one, while still giving you the same file size.

You are probably confusing yourself by some kind of measure about how well the transcoding preserves the resized video, not the original video. If so then think about the extreme: resize your original down to 6x4 pixels. Won't the result have the perfect quality by your definition?

Your,
Patilan
Reply With Quote
  #8  
Old 11-19-2006, 05:58 PM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Quote:
Originally Posted by Patilan
The above is simply incorrect. What's more, given an equal bitrate, a resized video will be definitely of lesser quality then the unresized one, while still giving you the same file size.
I know I'm new to all of this, but since you're saying a higher resolution video can be compressed to the same bitrates as a lower one without blocking then why does anyone bother resizing? I freely admit I don't know enough to debate the issue, but are you telling me everyone else is wrong and you're correct that a 740*480 video can be compressed to the same file size as a 624*352 without experiencing more blocking?

All I have to go by is my own experience. If I transcode the exact same video with the same bitrate with one resized and the other not the higher resolution video results in more blocking. Of course if the bitrate is high enough, this won't be the case.

Quote:
You are probably confusing yourself by some kind of measure about how well the transcoding preserves the resized video, not the original video. If so then think about the extreme: resize your original down to 6x4 pixels. Won't the result have the perfect quality by your definition?
I'm not talking about a ridiculously low resolution like you're suggesting. I understand there is a trade off between resolution and bitrate. You seem to be saying there is no trade off and that a high resolution video can be compressed to the same file size as a lower one without experiencing increased blocking.

Last edited by blade; 11-19-2006 at 06:07 PM.
Reply With Quote
  #9  
Old 11-19-2006, 06:58 PM
Patilan Patilan is offline
Sage Advanced User
 
Join Date: Oct 2006
Location: Lake Forest, Illinois, USA
Posts: 237
Quote:
Originally Posted by blade
why does anyone bother resizing?
Sometimes you have to. For example, if you plan to transfer the video to some handheld device which can accept only certain specific resolutions.

Quote:
Originally Posted by blade
are you telling me everyone else is wrong and you're correct
I am certaianly not saying this. And I am clueless who this "everyone else" might be (apart from you) that's advocating resizing as a method for improving quality. In fact, I've already given you links for exactly the opposite, people advocating that you shouldn't be resizing even if you life depened on it.

Quote:
Originally Posted by blade
...that a 740*480 video can be compressed to the same file size as a 624*352 without experiencing more blocking?
In your example these 740*480 and 624*352 are not the same video. We could say they are the same video if the second one resulted from the first one by just cropping. But this is not your case. Your second video is a somewhat blurred version of your first video. Which brings us to the blocking you are talking about, and blocking is a completely sepatate issue. The blocking can be handled either by a deblocking filter during the transcoding (which ffmpeg unfortunately lacks) or/and by a deblocking filter in the player during the playback. (or sometimes by enabling smaller partition sizes during the transcoding, depending on which codecs we're talking about) Blurring the video is not the best way for dealing with blocking, but that's what you coincidently achieved with the resizing.

I was not suggesting you go for ridiculously low resolution. I gave an extreme example to illustrate my point. Seriously, if you think that resizing down to 624*352 improves quality, then why stop there?

By the way, when I played with xvid some time ago, I too was not very happy with the amount of blocking that I got in my videos. I am not sure if I was doing something wrong, or it's just what xvid is. Probably the former. So I abandoned xvid for h264 and never looked back.

Blade, I just saw what evilpenguin wrote here. That may be the "Holy Grail"! I am yet to test it but I am really excited.

Patilan
Reply With Quote
  #10  
Old 11-19-2006, 10:27 PM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Quote:
Originally Posted by Patilan
I am certaianly not saying this. And I am clueless who this "everyone else" might be (apart from you) that's advocating resizing as a method for improving quality. In fact, I've already given you links for exactly the opposite, people advocating that you shouldn't be resizing even if you life depened on it.
I'm in no way advocating piracy. With that said there are thousands of videos available for download that have been resized and are intended to be played back on PCs or set top players. So saying I'm the only one who thinks resizing can be useful is crap. If they can use the same bitrates with higher resolutions and get better results why don't they do it?

Also please quote and highlight where I said resizing improved quality. I said resizing allows me to get better results at lower bitrates than if I kept the original resolution.

As for people saying you should never resize no matter what, I've ready plenty of threads on doom9 that state when reducing bitrate beyond a certain point you get less blocking and ringing by resizing to a lower resolution. As a matter of fact it appears quite common to suggest lowering the resolution in order to get better results at lower bitrates than what is possible with the full resolution.

Quote:
In your example these 740*480 and 624*352 are not the same video. We could say they are the same video if the second one resulted from the first one by just cropping. But this is not your case. Your second video is a somewhat blurred version of your first video. Which brings us to the blocking you are talking about, and blocking is a completely sepatate issue. The blocking can be handled either by a deblocking filter during the transcoding (which ffmpeg unfortunately lacks) or/and by a deblocking filter in the player during the playback. (or sometimes by enabling smaller partition sizes during the transcoding, depending on which codecs we're talking about) Blurring the video is not the best way for dealing with blocking, but that's what you coincidently achieved with the resizing.
As I said before I don't know all that much about transcoding. I simply stated what I've found from personal experience with the Sage's built in transcoding. I'm not interested in setting up 3rd party apps and going to a lot of trouble to transcode shows that I intend to watch once and delete. I'm trying to find the best settings for me with the built in support.

I'll ask again if blocking is so easy to get around and resolution has no impact on how low of a bitrate you can get away with why don't people compress full resolution 1920x1080i video down to 350-700mb XviD files? The ones I've seen have always been resized to lower resolutions.

Quote:
I was not suggesting you go for ridiculously low resolution. I gave an extreme example to illustrate my point. Seriously, if you think that resizing down to 624*352 improves quality, then why stop there?
I understand you weren't suggesting going that low, but you were using a ridiculously low example which of course would never be acceptable to use. That in no way proves that a lower resolution can't provide better results than a higher resolution when using low bitrates.

Once again I never said it improved quality. I said I could lower the bitrate and get better quality than if I tried to lower the bitrate while maintaining the full resolution. Of course when you lower resolution or bitrate you're going to lose quality. My point is a lower resolution at certain bitrates can maintain better quality than higher resolutions at the same bitrate. I'm sure you'll disagree, but there are plenty of people who think otherwise.

Last edited by blade; 11-19-2006 at 10:29 PM.
Reply With Quote
  #11  
Old 11-20-2006, 10:24 AM
Patilan Patilan is offline
Sage Advanced User
 
Join Date: Oct 2006
Location: Lake Forest, Illinois, USA
Posts: 237
Quote:
Originally Posted by blade
I'm in no way advocating piracy. With that said there are thousands of videos available for download that have been resized
And most all of those "thousands of videos available for download" look like crap.

Quote:
Originally Posted by blade
I'm currently having to resize the video to 640*480 then crop. It would be much better if I could just crop and set the aspect ratio.
Right. Apparently I misunderstood you, and we went way off topic, so forget I said anything.

Now back to your original question... I hope that I'll have some time this weekend to play with xvid and see why it's ignoring the -aspect switch.

Patilan
Reply With Quote
  #12  
Old 11-21-2006, 10:35 AM
clmolnar clmolnar is offline
Sage Advanced User
 
Join Date: Nov 2005
Posts: 129
On a related note, I have been looking at the transcoding options for mencoder and ffmpeg, but I don't see where the switches used in the sage.properties file are actually coming from. Maybe these are documented elsewhere, and I am looking in the wrong place?

My goal is to transcode my recordings to Xvid format using 2-pass encoding. I want the final file size to be approximately 1GB an hour. Is this even possible with the current SageTV transcoder? What would be the line that I need to add to the sage.properties file?

Thanks for any help.

Carl Molnar
Reply With Quote
  #13  
Old 11-21-2006, 06:07 PM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Quote:
Originally Posted by clmolnar
My goal is to transcode my recordings to Xvid format using 2-pass encoding. I want the final file size to be approximately 1GB an hour. Is this even possible with the current SageTV transcoder? What would be the line that I need to add to the sage.properties file?
That is exactly what the first two profiles in post #3 of this thread do. With the exception of the 1GB/hour file size. You'd need to increase the bitrate a little to get there. I think the one for regular 4x3 content comes out at around 930MB/hour.

If you're dealing with regular 4x3 content try the second profile in post #3. If you have 4x3 letterboxed try the first one in post #3.

If you'd rather not resize and would like to set the aspect ratio during playback instead of using source just delete w\=640;h\=480; from the profiles and it will maintain the original resolution.

I don't know much about this stuff, but since not many others seem interested I'll help what little I can. Maybe someone else can come along and tell us the profiles are crap and offer some better ones.
Reply With Quote
  #14  
Old 11-22-2006, 08:35 AM
clmolnar clmolnar is offline
Sage Advanced User
 
Join Date: Nov 2005
Posts: 129
I didn't think those profiles were 2-pass? If they are, what specifies it in the command line?

Thanks
Reply With Quote
  #15  
Old 11-22-2006, 11:37 AM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
Quote:
Originally Posted by clmolnar
I didn't think those profiles were 2-pass? If they are, what specifies it in the command line?
Nothing, it is specified elsewhere in the sage properties file with:

transcoder/enable_multipass_encoding=true

My understanding is that you can't specify single or multipass with the profiles. Either all of them use it or none of them do. Of course there isn't any real documentation or guides so that's just from what I've read here and there.

Last edited by blade; 11-22-2006 at 11:44 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.