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 02-15-2008, 02:32 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
Mencoder help - HD Mpeg2 to H264/AC3

A bit of background:
My source material is all mpeg-2 (PS or TS, depending how I save my .tivo captures in videoredo) with AC3 2.0 or 5.1. Most is 1080i, some is 720p, and without checking each file, I would say most are 29.97 fps (video source). Most everything is high bitrate too, ranging from 17.5-18.8 mbps.

My playback is entirely confined to an HD extender, HDMI at 1080i (for now until Sage fixes my 1080P issue). Audio is output over HDMI as well, not sure that will matter in this case though.

Goal is to encode these into H.264 and maintain AC3 track. I also intend to de-interlace everything, and if it is film-based, maybe put it to 23.976 fps. Overall, if I could get 30-40% space savings, and not see a difference in playback I would be very happy.

So getting to the video encoding, and using mencoder's CLI, I see where lobosrul in this thread cropped his 1080i shows by 10% for overscan, but this is just for his time savings right? On a TV with little or no overscan, no cropping should be done right? I also see references to scaling to 720p (reduced again by 10% for ovescan). If my goal is a reduced filesize some, with maximum video detail retained, would I want to do this, or skip cropping and scaling completely? I plan to try both 720p and 1080p outputs, but figured if anyone had a pointer, it would save me at least the encoding time for 1 file.

I'm doing my encoding on a MAC, so hopefully that in itself wont cause any issues. I've tried ffmpegX, Streamclip, VisualHUB, and nothing seems to want to give me a final file that has H.264 and the AC3 track passed through. I either end up with AAC (2.0 or 5.1) or late last night I even got a AC3 2.0 stream (from an AC3 5.1 source). If another program would be better to use (FCS 2, Quicktime Pro?) I can do that as well.

Should I be trying to get to a MKV container? Or is there another suitable container that I can use, that doesnt mind having AC3 inside it? This maybe is part of my issue above with the MAC gui frontends?

And if I have all this totally wrong in my head, please feel free to point me in the right direction Or hit me over the head or whatever you deem necessary!
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #2  
Old 02-15-2008, 02:54 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Yes, you should be using an MKV container. The MP4 container is not compatible with AC3 audio.
Reply With Quote
  #3  
Old 02-15-2008, 05:27 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
You should check out my video tools plug-in for SageMC. It does everything your talking about and more automatcially. I don't think i'm exagerating when I say its the easiest and best way to compress SDTV/HDTV.

Also, and this is a little known fact, you you can use it as a standalone tool completely independant of Sage. All you have to do is download/extract the plug-in, run one simple .exe, and it will automatcailly generate a batch files that you can do drag n' drop encoding.

edit: Bah, nm, didn't notice you were running a hackintosh

You're best bet is going to be w/ Handbrake when they release 9.2 as they've added a lot of code recently to handle HDTV/SDTV mpgs in addition to DVD's. The only issue you'll find is that they're ITVC is tuned specifically for DVD's and hasn't been adjusted to handle HDTV yet. Last I checked they were working on it with 1080i clips but there hasn't been any meantion of 720p.

Last edited by evilpenguin; 02-15-2008 at 05:34 PM.
Reply With Quote
  #4  
Old 02-15-2008, 06:37 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
Yeah I suppose I could set back up a windows server, which means running another PC, and use your plugin. It would also be cheaper in the short term (wouldnt have to pay for another MAC license). But its really nice only having 1 PC running now, thanks to the HD Extender!

I guess I will check out the next version of handbrake when its out. I have successfully used mencoder's CLI now, and made a .264 and .ac3 file. Now I have to find something in MAC that can mux them together, or else get them into a windows environment (VMware session) and mux them with something.

Have a good suggestion for a muxing program that can take my files and put them into an MKV? I would guess MP4Box might be able to do it in windows?
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #5  
Old 02-15-2008, 06:41 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
MKVtoolnix. It has MKV Merge as part of it. If you de-mux the original AC3 you can mux it in and throw out the audio from the original MP4 file.

I hope the Handbrake crew has revamped their reverse telecine engine. Because quite frankly it sucks. It falls apart when you get a badly mixed movie like Mall Rats. Between scene changes you get sections that are properly reverse telecined and then scenes that have all the jaggies. It looks terrible. That's the main reason I've dropped Handbrake and started using AutoMKV. It has it's own set of problems but at least it's reverse telecine engine is notably better.
Reply With Quote
  #6  
Old 02-15-2008, 06:44 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
Oh I've used MKVtoolnix before.. when I was doing some BD/HD rips. As for handbrake, I am downloading xcode3 right now so I can build the latest from SVN, and see how it does. Hopefully it will work out ok.
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #7  
Old 02-15-2008, 07:12 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
Quote:
Originally Posted by Taddeusz View Post
I hope the Handbrake crew has revamped their reverse telecine engine. Because quite frankly it sucks. It falls apart when you get a badly mixed movie like Mall Rats. Between scene changes you get sections that are properly reverse telecined and then scenes that have all the jaggies. It looks terrible. That's the main reason I've dropped Handbrake and started using AutoMKV. It has it's own set of problems but at least it's reverse telecine engine is notably better.
One of the handbrake devs really dug into this over the few months (since 9.1) and the implimentation has improved greatly for DVD's. I hope they continue to extend the implimentation to handle the special needs of recorded content as well.
Reply With Quote
  #8  
Old 02-16-2008, 12:23 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
Wow the new Handbrake (even though its a dev build) is great compared to the old version!

So what is a good target bitrate to aim for? 3000? That just seems low to me, but maybe thats all it that needs to be?
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #9  
Old 02-16-2008, 01:35 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
Quote:
Originally Posted by Kirby View Post
Wow the new Handbrake (even though its a dev build) is great compared to the old version!

So what is a good target bitrate to aim for? 3000? That just seems low to me, but maybe thats all it that needs to be?
I personally like my HDTV scaled to x688 @ 1500.
Reply With Quote
  #10  
Old 02-16-2008, 01:44 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
Is there a point of no return on the bitrates? I just did some sample encodes, one at 3000, one at 5000. Both are output at 1920x1080p. In the 5000 bitrate, I can see a bit more detail in a few scenes. One in particular was the exhaust of an M1 tank, and at 5000 it just appears a bit more defined. Either way, I am getting a very nice space savings. Sample file was 239MB, 3000 bitrate encode was 45MB, and 5000 bitrate was 71MB.

I'm not really sure how scaling the output file would help or hurt me. I dont mind long encode times (quad core cpu) and my goal is to maintain nearly the same detail as the source. Not sure I fully understand the effect of scaling to 688. Care to elaborate (or is it mentioned in your STVi thread?).
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #11  
Old 02-16-2008, 02:42 PM
lobosrul's Avatar
lobosrul lobosrul is offline
Sage Expert
 
Join Date: Aug 2005
Location: Albuquerque, NM
Posts: 573
Kirby:

The main reason I crop by 10% is just to save space. The less pixels, the less bitrate needed to avoid artifacting. If you have a TV that always overscans you probably don't want to crop the source.

As far as bitrate from 3000 to 5000, you must be encoding something thats low motion. I can usually tell the difference going from 3000 to 5000 for 720p encodes. 1080p generally requires 6000-8000 IMO, unless its a 2.39:1 letterboxed source, in which case you can compress more.

I've also started doing my encodes with AC3 audio, since the SageTV HD extender doesn't fully support AAC 5.1 (future-proofing). I don't see why you need to use an mkv container for TV, unless you want subtitles or a second audio stream. I've heard that AVI containers lead to audio sync problems, but I haven't encountered any.

Here's my execution chain for AC3 in AVI:

Code:
vp.vbs "E:\WeatherPlusUniversity-2714509-0.vprj" "E:\new\WeatherPlusUniversity-2714509-0-clean.mpg"
mencoder.exe "E:\new\WeatherPlusUniversity-2714509-0-clean.mpg"   -sws 9 -vf pullup,crop=720:480:0:0,scale=0:0:0:0:4,harddup -ofps 24000/1001  -oac copy  -ovc x264 -x264encopts deblock:qcomp=.7:bframes=3:turbo=1:threads=2:b_pyramid:pass=1:bitrate=1000  -o "E:\new\WeatherPlusUniversity-2714509-0.avi"
mencoder.exe  "E:\new\WeatherPlusUniversity-2714509-0-clean.mpg"   -sws 9 -vf pullup,crop=720:480:0:0,scale=0:0:0:0:4,harddup -ofps 24000/1001  -oac copy  -ovc x264 -x264encopts deblock:qcomp=.7:subq=5:8x8dct:frameref=4:bframes=3:b_pyramid:weight_b:threads=2:pass=2:bitrate=1000 -o "E:\new\WeatherPlusUniversity-2714509-0.avi"
You can of course leave the crap and scale sections completely off if you want.

I do however use mkv containers for encoding DVD these days. Thats because sometimes I like to have a 2nd audio channel. Its the same principal as with aac and mp4box. One needs a separate h.264 and AC3 file, the mux them together with mkvmerge.
Reply With Quote
  #12  
Old 02-16-2008, 02:51 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
The scene I was referring to was pretty much static. It had an M1 tank sitting still, firing off a few rounds. I will try bumping up the bitrate to 8000 (a value I was experimenting before I got the new handbrake going). I'll also look for a higher motion scene to test on.
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #13  
Old 02-20-2008, 06:47 PM
Kirby's Avatar
Kirby Kirby is offline
Sage Icon
 
Join Date: Jan 2006
Posts: 1,253
So the new version of Handbrake is out today, 0.92. And it has the option to put H.264 and AC3 inside an MP4 container. Didnt think that was a supported combo? It also has some other nice options that the developmental build I was using didnt have, such as a preset for AVC+AAC5.1+AC3 inside an AVI container.

I guess the biggest question I would have is, is there any reason not to continue using an MKV container, but instead use AVI? I certainly can see no reason to do the AAC and AC3 combo personally, so it would be H264+AC3 inside AVI, or keep with the MKV container. Isnt this choice (at least in this case) pretty much like the choice between RAR and ZIP, i.e. personal preference?
__________________
Sage Server: HP ProLiant N40L MicroServer, AMD Turion II Neo N40L 1.5GHz Dual Core, 8GB Ram, WHS2011 64bit, Sage 7.1.9 WHS, HDHR (1 QAM, 1 OTA), HDHR Prime 3CC, HD-PVR for copy-once movie channels
HTPC Client:Intel DH61AG, Intel G620 cpu, 8GB ram, Intel 80GB SSD, 4GB RamDisk holding Sage/Java/TMT5
Sage Client:Sage HD-200 Extender
Reply With Quote
  #14  
Old 02-20-2008, 07:14 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
AC3 in mp4 is a hack, but like the devs say here, Apple did it first

As for containers, it's like you said, personal preference and mine is currently mkv.

I haven't tried the new 9.2 yet, but i'm pretty excitted to play with it this weekend.

Last edited by evilpenguin; 02-20-2008 at 07:17 PM.
Reply With Quote
  #15  
Old 02-20-2008, 09:47 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
AVI doesn't support many of the more advanced features of H.264 so it's not actually the best combination. For H.264 you're better off sticking with either MP4 or MKV containers.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #16  
Old 02-20-2008, 11:28 PM
btrcp2000 btrcp2000 is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 888
Quote:
Also, and this is a little known fact, you you can use it as a standalone tool completely independant of Sage. All you have to do is download/extract the plug-in, run one simple .exe, and it will automatcailly generate a batch files that you can do drag n' drop encoding.

@evilpenguin:

can you walk me through using this as a standalone app? I am trying to find an easy way to periodically move some sage recordings minus commercials to a portable media player for the kids to use in the car, but the archos av500 requires mp4 or avi. I don't have much need for space on my sage server at the moment, so I don't need sage to reencode everything. If I can get this to work as a standalone, I can periodically reencode a bunch of kids shows on another pc until they get bored with them, then wipe and do it again. What are the steps to accomplish this, preferably several files at once (not simultaneously, but set and forget overnight or something like that).

thanks for the help!
__________________
[size=1]Current Server:V9 UNRAID Docker, SuperMicro x9dri-LNF4+, 32 GB ECC, 2x Xeon e5-2660v2, storage array 6TB, 2 Dish r5000HD tuners, 1 HDHomerun Quatro, 1 HDHomerun Extend
4 Nvidia Shield TVs with Miniclient
Reply With Quote
  #17  
Old 02-20-2008, 11:37 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
Quote:
Originally Posted by btrcp2000 View Post
@evilpenguin:

can you walk me through using this as a standalone app?
Its super easy to use!

1) Download the plug-in.
2) Extract it to anywhere, doesn't need to be the SageTV folder
3) Run "profile2bat.exe", it will create a new "encodingBatchFiles" folder
4) Drag and drop any video onto a batch file and it will encode it.

I highly recommend using "Auto Encode". If you want to tweak the profiles for a more custom encode, let me know and i can walk you through that too.
Reply With Quote
  #18  
Old 02-21-2008, 09:17 AM
lobosrul's Avatar
lobosrul lobosrul is offline
Sage Expert
 
Join Date: Aug 2005
Location: Albuquerque, NM
Posts: 573
Quote:
Originally Posted by Taddeusz View Post
AVI doesn't support many of the more advanced features of H.264 so it's not actually the best combination. For H.264 you're better off sticking with either MP4 or MKV containers.
h.264 looks exactly the same no mater what container it's in. MKV has the advantage of supporting nearly every kind of video/audio stream there is, plus multiple audio and subtitle streams.
Reply With Quote
  #19  
Old 02-21-2008, 09:34 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by lobosrul View Post
h.264 looks exactly the same no mater what container it's in. MKV has the advantage of supporting nearly every kind of video/audio stream there is, plus multiple audio and subtitle streams.
While that sounds like it would be so I've ran into problems with my AVI/H.264/AC3 rips. Really choppy video playback in VLC and on my HD Extender. The MKV container works great on the same videos. My understanding is that AVI tends to ignore certain advanced features of H.264 such as pyramidal B-frames. I know it sounds weird that a container can "ignore" stuff from a stream but I'm just reporting my experience and what I've read about it. And honestly AVI is really dated.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #20  
Old 02-21-2008, 10:44 AM
lobosrul's Avatar
lobosrul lobosrul is offline
Sage Expert
 
Join Date: Aug 2005
Location: Albuquerque, NM
Posts: 573
Quote:
Originally Posted by Taddeusz View Post
While that sounds like it would be so I've ran into problems with my AVI/H.264/AC3 rips. Really choppy video playback in VLC and on my HD Extender. The MKV container works great on the same videos. My understanding is that AVI tends to ignore certain advanced features of H.264 such as pyramidal B-frames. I know it sounds weird that a container can "ignore" stuff from a stream but I'm just reporting my experience and what I've read about it. And honestly AVI is really dated.
Hmm, I have no playback problems at all (mplayer & CoreAVC), and I do use pyramidal B-frames. I have no way to test on the HD extender though.

I'll do an experiment this evening: demux one of my AVI's and remux to mkv and see if the quality is any better. I mux into mkv's for DVD encodes anyway; I use AVI's for TV rips out of laziness more than anything, mencoder muxes to AVI itself.
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
List of issues Sage 6.3.6 with HD extender Spriter SageTV Beta Test Software 5 01-24-2008 09:31 AM
HD Homerun Recording High CPU Usage smarty Hardware Support 6 10-18-2007 05:31 AM
HD 2400/2600 and Mpeg2 fyodor Hardware Support 2 07-20-2007 07:52 PM
The Beginning of the End? lobosrul General Discussion 76 05-01-2007 06:39 PM
Multiple HD recording issue ptaylor Hardware Support 0 02-23-2007 11:10 PM


All times are GMT -6. The time now is 08:41 AM.


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