SageTV Community  

Go Back   SageTV Community > General Discussion > General Discussion
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

General Discussion General discussion about SageTV and related companies, products, and technologies.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-23-2008, 09:21 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Interlaced H.264?

Anyone know how to create interlaced H.264 files? I know it's supported by the MPEG4 standard. But I don't see any tools that are able to create interlaced videos. I did find a note that x264 is not able to create interlaced videos.

Just curious. I have some videos I'd like to convert but I'd rather not de-interlace them for the conversion.
Reply With Quote
  #2  
Old 01-23-2008, 09:45 AM
CollinR CollinR is offline
Sage Icon
 
Join Date: Dec 2004
Location: Tulsa, OK
Posts: 1,305
I'm pretty sure MPEG (h.264 is MPEG4 part 10) compression basically can't be interlaced, you can deinterlace then compress and then reinterlace if you like but it's compression methods compare frames for redundency.
Reply With Quote
  #3  
Old 01-23-2008, 10:04 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Doing a little bit further searching it looks like (according to the Wikipedia page on MPEG4 Part 10) x264 can create interlaced coded video using MBAFF.

I'll have to dive further into that. It appears that most of the encoders that support interlaced coding , save for x264, are for professional use.
Reply With Quote
  #4  
Old 01-23-2008, 10:25 AM
CollinR CollinR is offline
Sage Icon
 
Join Date: Dec 2004
Location: Tulsa, OK
Posts: 1,305
I guess the big question is why would anyone want to? or What is the bigger picture you have?
Reply With Quote
  #5  
Old 01-23-2008, 10:35 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
I have some DVD's that are straight interlaced video and not telecined. I'd like to convert them to a smaller size to store them on my server but keep them in interlaced format. That way whatever playback device is being used can handle that.

Edit: it appears I can create an interlaced video by using the "--interlaced" option with x264. :-D

Last edited by Taddeusz; 01-23-2008 at 10:38 AM. Reason: added info
Reply With Quote
  #6  
Old 01-23-2008, 10:49 AM
lobosrul's Avatar
lobosrul lobosrul is offline
Sage Expert
 
Join Date: Aug 2005
Location: Albuquerque, NM
Posts: 573
I sometime leave my interlaced material as interlaced when encoding to x264 (mencoder). You need to be careful however, as it requires the height, and I think the width of the encoded file to be mod16.

Also not all hardware playback devices do de-interlacing. If you plan on using one to playback your files, your much better off encoding with a de-interlace filter (i like yadif).

The only times I don't de-interlace on encoding is if the source is hi-motion (football games), or a PAL conversion (ie masterpiece theatre).
Reply With Quote
  #7  
Old 01-23-2008, 11:06 AM
jasongrimme jasongrimme is offline
Sage User
 
Join Date: Jan 2007
Posts: 49
Quote:
Originally Posted by Taddeusz View Post
I have some DVD's that are straight interlaced video and not telecined. I'd like to convert them to a smaller size to store them on my server but keep them in interlaced format. That way whatever playback device is being used can handle that.

Edit: it appears I can create an interlaced video by using the "--interlaced" option with x264. :-D
Hello Taddeusz,

I use Handbrake and the x264 settings you posted (http://forums.sagetv.com/forums/showthread.php?t=28963). Before you posted those settings, I noticed some DVDs I had ripped with older content (from 80's TV shows, mainly) had vertical lines and I figured it was an interlacing issue. When a re-encoded them using our x264 parms, the symptom was drastically reduced.

Is it possible it wasn't actually an interlaced problem, given I did not add the --interlaced option? something else?

Also, is there a way to determine what video sources would benefit from the --interlaced option?

I've found your info and posts regarding compressing video to mpeg4, and my preferred target of x264 in an mkv file very valuable, thanks for all your input!!!
Reply With Quote
  #8  
Old 01-23-2008, 11:30 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Ok, let me give a little back story I forgot to mention. I had played around with creating interlaced H.264 videos from some music videos I'd ripped from DVD. The problem I was having is that it was showing up as 480p instead of 480i in SageTV like the original MPEG2 rips did. As a result the fields were combined and not in half frames and looked like crap on my TV. I didn't know how to tell the encoder to code it as interlaced so I gave up for a while. I'm now interested in it again.

I'm at work right now but I'm going to play around with it tonight. It looks like using AutoMKV I can disable all de-interlacing options and then add "--interlaced" to the command-line and see what it spits out.

On a side note. I know I've been an avid supporter of Handbrake. I'm now reformed. I've discovered that Handbrake has a really crappy reverse telecine engine. They actually admit it themselves. Apparently they're working on it. AutoMKV on the other hand seems to be awesome at detecting bad editing and such and produces awesome output. My trouble case was Mallrats where scene changes would go from good to bad back to good. I also had some movies that were improperly detected by Handbrake and got encoded at 29.97fps rather than 24.976fps. As a result they were jittery. AutoMKV produced the correct output in both cases.

That being said AutoMKV is not perfect. When creating an MKV the resulting file does not have the SAR in the bitsream because mkvmerge strips it out by default. It also does not produce correct anamorphic SAR values when told to do so automatically. I've had to manually input the correct values into AutoMKV and then mux them myself so that they'll be played with the correct anamorphic aspect ratio in SageTV.

I know way too much about this stuff now. Particularly after my crash session last weekend when I was trying to fix the SAR as well as converting the AAC 5.1 audio to AC3 on an aquired video so it would play correctly on SageTV and my HD Extender. I was for a couple hours trying to get the number right. The light bulb finally popped on and my brain hurt for quite a while after that. Needless to say I got it figured out and am more knowledgeable on the topic as a result.
Reply With Quote
  #9  
Old 01-24-2008, 12:39 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Well, just to update everyone. I was able to create interlaced H.264 videos but I had to use MeGUI. The problem I've run into is that SageTV detects it as 480p instead of 480i. I've contacted support to see if there is a way to fix that.

I've verified that the video is actually interlaced. I demuxed the mkv file and played the raw H.264 file in VLC. It doesn't know the framerate because it's a raw stream but it shows the resolution as 720x240. I'll have to play around some more and see if I can't get it working. Hopefully I'll hear something positive back from support.
Reply With Quote
  #10  
Old 01-28-2008, 08:45 AM
jasongrimme jasongrimme is offline
Sage User
 
Join Date: Jan 2007
Posts: 49
Wow, looks like you've tried most everything. I've found handbrake works fine (for me, anyway), on progressive sources, just not interlaced.

So, right now, your encoding the content w/ meGUI, or are you encoding with autoMKV and doing some post-processing w/ meGUI.

If/when you get things all figured out, I'd be interested in your findings. I thought Handbrake was doing fine with my interlaced material, but ran some TV mini-series through it and it looks pretty terrible.
Reply With Quote
  #11  
Old 01-28-2008, 09:08 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Handbrake actually isn't that great at all. Particularly because it doesn't reverse telecine stuff correctly.

At this point I'm not actually sure the files I was creating were really interlaced. The VOB's are processed through AVISynth before being sent to x264. Granted, I don't know how MPEG 2 stores interlaced fields but I have this sneaking suspicion that AVISynth is combining the interlaced fields into a single frame instead of keeping them apart. Even though I'm telling meGUI to do interlaced I don't think the input it's getting is. I don't know if there are any tools I can use to determine whether or not what I have is really interlaced or not.
Reply With Quote
  #12  
Old 01-28-2008, 09:55 AM
jasongrimme jasongrimme is offline
Sage User
 
Join Date: Jan 2007
Posts: 49
To determine if the mpeg2 is interlaced? I run them in dgindex, and the information screen tells if it is progressive or interlaced.

I'm thinking I'm going to end up with 2 encoding processes, one for progressive and one for interlaced, even if I have to use a different combination of tools. I'm also then categorizing content based on desired quality. I know you encode everything at 2Mbps, but I'm trying to conserve space a bit more, so I encode some content @ 1200Kbps (dramas, romantic comedies, etc), so another step to classify content as progressive or interlaced wont be that big of a deal for me.

So, are you still doing the automkv processes you mentioned? I didn't completely understand the muxing of the SAR step. Are you using autoMKV to encode from mpeg2/dvd vob, or is there another step in there?
Reply With Quote
  #13  
Old 01-28-2008, 10:36 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by jasongrimme View Post
To determine if the mpeg2 is interlaced? I run them in dgindex, and the information screen tells if it is progressive or interlaced.

No, to determine if the resulting H.264 stream is interlaced or not.


Quote:
Originally Posted by jasongrimme View Post
So, are you still doing the automkv processes you mentioned? I didn't completely understand the muxing of the SAR step. Are you using autoMKV to encode from mpeg2/dvd vob, or is there another step in there?
I've been involved in the latest beta of AutoMKV. He's corrected at least the major problem I was having with it. And that's the fact that mkvmerge strips the bitstream AR which SageTV requires. He's added a checkbox to tell mkvmerge to keep the bitstream AR.

Unfortunately he doesn't seem to be very good at the maths. Even after several people, including myself, have described in detail the math behind calculating the correct SAR value to pass to x264. It's not really that huge of a deal. I already have the values calculated for the two aspect ratios I need.

Right now I'm just happy that I can use AutoMKV without having to do a separate mkvmerge run to create a file that still has the bitstream AR. I have the AR stuff saved as the default options so if the movie is 16:9 it's all hands off for me now. And I can mux in the DTS audio if the DVD has it. Handbrake wouldn't do pass-thru DTS.
Reply With Quote
  #14  
Old 01-28-2008, 01:49 PM
valnar valnar is offline
Sage Icon
 
Join Date: Oct 2003
Posts: 1,252
Send a message via ICQ to valnar
Taddeusz,
Since all TV's have to deinterlace in real-time, I find it hard to believe that there isn't some offline deinterlace filter that won't do a better job. Is there another reason why you want to keep some of your material interlaced?

On another note, what are the custom SAR parameters that you put into AutoMKV? What's not fixed in beta21? Buzzhq is pretty quick to make changes as long as he understands it.

Robert
Reply With Quote
  #15  
Old 01-28-2008, 02:50 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by valnar View Post
Since all TV's have to deinterlace in real-time, I find it hard to believe that there isn't some offline deinterlace filter that won't do a better job. Is there another reason why you want to keep some of your material interlaced?
I don't have an HDTV yet, so my TV is still of the older type. And I'm also kind of obsessive. I'd rather keep interlaced material interlaced.

Quote:
Originally Posted by valnar View Post
On another note, what are the custom SAR parameters that you put into AutoMKV? What's not fixed in beta21? Buzzhq is pretty quick to make changes as long as he understands it.
The formula is V/H*HAR/VAR . So, say I have a 16:9 video with a res of 720x480. So, it works out like this (480*16)/(720*9)=7680/6480. So the SAR value would be 7680:6480. It has to be in that format, can't be decimal.

It appears the values he computes for that is basically something like (16/9*100000000):100000000 so it turns out to be 177777770:100000000 on the command line (or something like that, I don't remember the number of zeros). The formula he should be using is the one above. He should be using that for ALL aspect ratio computations. Not just anamorphic. It's computed the same no matter whether you have square pixels or are using an anamorphic presentation. Oddly enough I've run into a problem where VLC wouldn't play a square pixel video correctly without the decimal AR muxed into it. I thought that was pretty weird. Of course it was a video that didn't have a standard 16:9 size. Something weird like 1920x858. I computed the value using that formula and it worked fine. Just weird.

I think one of the other posters said that it's a bug when you use anamorphic video, select Original as the video width and don't use cropping. Which is what I'm doing. That's the main reason I haven't really worried about it that much. I have the SAR values precomputed that I need to use so it's just a matter of copy and paste. Most of my stuff is 16:9 which I have saved in the defaults. I only need to change things up when I do something that's 4:3.

I didn't verify that bug. That's just what I gathered from someone else.

Last edited by Taddeusz; 01-28-2008 at 02:51 PM. Reason: correction
Reply With Quote
  #16  
Old 01-28-2008, 03:07 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by Taddeusz View Post
The formula is V/H*HAR/VAR . So, say I have a 16:9 video with a res of 720x480. So, it works out like this (480*16)/(720*9)=7680/6480.
Not to be picky because I know nothing about this but if the formula is V/H*HAR/VAR wouldn't it be 480/720*16/9 or should your formula have been (V*HAR)/(H*VAR)? Or are they mathematically the same - it's been a long time since I had classes of any kind!
Reply With Quote
  #17  
Old 01-28-2008, 03:07 PM
valnar valnar is offline
Sage Icon
 
Join Date: Oct 2003
Posts: 1,252
Send a message via ICQ to valnar
OK, Taddeusz. Thanks.


Quote:
Originally Posted by Taddeusz View Post
I don't have an HDTV yet, so my TV is still of the older type. And I'm also kind of obsessive. I'd rather keep interlaced material interlaced.
Man, do I feel like a knob. I just bought my HDTV a couple months ago and here I am assuming everybody else has a 1080p TV too.

Well, one can always assume that you intend to watch it on a monitor. Yah, that's it! That's what I was thinking.

-Robert
Reply With Quote
  #18  
Old 01-28-2008, 03:34 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by BobPhoenix View Post
Not to be picky because I know nothing about this but if the formula is V/H*HAR/VAR wouldn't it be 480/720*16/9 or should your formula have been (V*HAR)/(H*VAR)? Or are they mathematically the same - it's been a long time since I had classes of any kind!
They're mathematically the same. Jus two different ways of showing it. I know I showed both, probably kind of confusing. The first I did to show that you're multiplying two fractions. The second one I simplified it and showed how you come up with the two numbers. It all works out the same though because it's all multiplication and division so you'd work both of them using mathematical rules and end up with the same decimal number. But the latter version is easier to look at to achieve the fraction that's needed.
Reply With Quote
  #19  
Old 01-29-2008, 07:54 AM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by Taddeusz View Post
They're mathematically the same. Jus two different ways of showing it. I know I showed both, probably kind of confusing. The first I did to show that you're multiplying two fractions. The second one I simplified it and showed how you come up with the two numbers. It all works out the same though because it's all multiplication and division so you'd work both of them using mathematical rules and end up with the same decimal number. But the latter version is easier to look at to achieve the fraction that's needed.
Yes if I hadn't been so tired yesterday I would have done the math and realized it myself - Thanks.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
SageTV Mac Client won't show h.264 stream? niknas SageTV Mac Edition 3 10-21-2007 09:36 AM
Perfect r5000-hd H.264 playback HawgGuy SageTV Software 6 09-08-2007 06:25 PM
r5000hd h.264 vs Quicktime H.264 playback HawgGuy Hardware Support 0 04-30-2007 08:09 AM
Two Questions. H.264 and Tag Parsing kranzel SageTV Software 0 01-16-2007 04:20 AM
Help creating h.264 mp4 with SageTVTranscoder Wade SageTV Beta Test Software 5 11-19-2006 06:17 PM


All times are GMT -6. The time now is 12:23 PM.


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