Here's my third post. This time about H.264 encoding.
I found out from some posts that H.264 is the best way for transcoding for saving some hard disk megabytes and still keeping the best quality.
I know that using postprocessing is the easiest way and the way almost everyone here is doing it. I don't like it much however since I like keeping everything running with the least programs as possible. I'm picky, i know, but well, this is how I got it -kinda- working.
I can now confirm that it's the best encoder. It for certain is a CPU intensive process and a slow one (in an athlon 64 X2 4850e it takes about 2.3x the time to transcode a recording) but the filesize is half the original of MPEG-2 (i'm recording in medium) and the quality is just great. I can't differentiate it from the original. And I'm sure you'd be able to improve it a little bit more, but I'm more than pleased with the results as they are right now.
I googled a lot for this, searched this forum and others, and just couldn't find a concise reference and that's why i'm writing this.
It's more than curious and I haven't been able to get it 100% working. First, I tried a command line I found on a forum somewhere in the internet, but it used libx264 and libfaac codecs which AREN'T included in the ffmpeg that comes with gbpvr. Well, a little background with ffmpeg - the way i see it:
FFMPEG is an extremely powerful very little documented utility. It is intended for people who know what they're doing. As a matter of fact, binaries aren't even provided by the developers and everyone who wants to use it has to compile their own version and so, because there are tons of codecs and just doesn't make sense to compile everything in.
So I went and found out a binary that had libx264 and libfaac compiled in. Found it, didn't work with some of the command line options provided in that forum so I decided I'd better work with the included ffmpeg. Upon inspection, I found the gbpvr included ffmpeg included h264 and mp3. I found a post on this forum (http://forums.nextpvr.com/showthread.php?p=325689), reddwarf posted some command line options. I had to remove a couple of them because they weren't recognized by the ffmpeg binary (specifically sc_treshold). Also, it's more portable because other users can expect the resulting command line to work with the gbpvr included ffmpeg instead of be hunting around for a working binary. In the end, this is what came out:
Maybe that's why I had to strip sc_treshold (it wasn't a recognized switch by the time I tested it)
I however see a big difference in my converted files and those from reddwarf. He says 350-450 megs for 52 mins whereas with me it would take about 900 mb(http://forums.nextpvr.com/showthread.php?t=41099). Maybe it's the -crf 22 part. I highly doubt the switches I missed would make much difference. Could you state your opinion on this reddwarf??
You of course have to include that line in config.xml at the section of CustomFFmpegConversions. Then, H.264 will appear in the dropdown list of GBPVR config and you can select it.
Notice the " symbols. I mention them because it gave me a Royal PITA to find out how to include them. Typing them wouldn't do and escaping them with a \ wouldn't either.
########################
Anyway here's the fun part:
As you can see, the filename has an AVI extension.
I have run lots and lots of tests. Lots of them. This darn H.264 encoders/decoders are really picky. They wouldn't play. I even ended up installing arcsoft totalmedia theatre to no avail. Upon experimentation I came out with a combination that works in the end. Apparently its ATI MPEG decoder that gets the job done.
The way to do it?
1. FFmpeg to .avi file as output
2. Rename .avi file to .mpeg file.
Yup... If you try to play .avi file in gbpvr it won't play
If you try to ffmpeg to .mpg file as output directly, it won't play either.
So, my solution is to first transcode with the ffmpeg line shown above to .avi and then use the attached postconversion.bat file in the gbpvr root directory
This would work great.. Exceeeeept!! When I change the extension, GBPVR doesn't find the recording anymore and the recording ddissappears from the recordings menu of GBPVR
Any way to make it work??
Find attached the -NON WORKING RIGHT- Postconversion.bat
Just right now it has ocurred to me. I'm going to disable the "delete original after transcoding" and I'm going to rename the original .mpg to something like .mpgback and then the .avi to .mpg. Maybe tomorrow I'll update on how it went.
Ok, here's my second post sharing my setup of HIP.
I'm attaching a HIP file I got that works just great for me.
First of all, I have an MCE edition RC6 remote control.
I setup HIP because of the following:
- I needed beeing able to control aspect ratio and that doesn't come stock.
- The dvd button wasn't correctly set.
- The info button didn't work as I wanted it to
- I wanted to be able to start PVRX2 directly with a button.
I installed HIP and got to the duplicate keystrokes problem: Hitting the down button got me down two channels and so on. You get the idea. It's a well documented problem you can find it in the HIP faq here: http://www.byremote.com.au/HIP/mce_remote_faq.htm (the last part)
But of course it wasn't going to be easy. Turns out, my remote wasn't listed in the device list of my computer. So upgrading to the mentioned driver wasn't an option. I tried using the generic keyboard interface, but turns out some of the remote control buttons don't transmit direct keystrokes, so out of question. Easiest was the registry modification:
Reboot and you'll find that now without HIP remote control keypresses aren't registered as keystrokes in the computer. With the file I attached in HIP, that functionality is replicated. However, remember, without HIP running windows won't register any remote-control keypresses as keystrokes.
Maybe it's documented somewhere else, but I didn't find it as clearly so I will explain what I found out about the way HIP functions.
First of all, make sure in HIP/Preferencies, you have:
In Alternate Input:
Select "Send commands to last selected application"
This makes HIP work with ANY aplication using the System-Wide Keys.
Here's an explanation of the way I understood it. The system-wide keys are for ANY Application UNLESS a specific application has a different command assigned to the keypress in the main window of HIP.
HIP receives a Key-UP keypress. First it checks what's the current application. If that application appears in HIP's main window (Program X), it checks if the keypress is lsited. If it is, it executes the command specified for Program X. If it doesn't appear, or if the program isn't specifically listed, it applies the action in System-Wide Keys.
Had you selected Unique Keys, it's a different story. With Unique Keys, every key is assigned to a single program and that's it!. That is, if the key-up key is pressed and that is assigned to PVRX2, the Key-UP is sent to PVRX2, regardless of if it has focus or not. Even if it is not running HIP will start it!
Also, in System Settings:
- Enable "Automatically load on startup" (remember your remote with the regedit modification won't work anymore without HIP)
- Enable "Automatically change key configuration" with decent polling time so that HIP stays warned when you select a new application.
Another important thing. At first I had all the commands with POST commands. those 32775 POST codes. First, they are much more difficult to find but in the end in one post here in the forums I found almost all of them.
HOWEVER, I found them problematic with my HTPC powermanagement setup (check my other forum post) so I setup HIP with only direct keystrokes and I even like it much more.
Find attached the .HIP configuration file. Of course, you'll have to check for paths, I'm running everything in spanish
I want to share my experiences and my setup for managing the power of my HTPC..
Here it goes:
What I want is:
1. Machine should hibernate if no remote activity is registered for a set period of time (say 1 hour)
2. If machine is working either recording a show or transcoding something then machine should not hibernate.
Notice how (2) doesn't mean any activity of remote/keyboard/mouse. And also, if we go by CPU activity, recording a show doesn't mean a lot of CPU activity (between 10-25%)
Windows integrated power management doesn't work because as soon as CPU usage jumps over 10%, it restarts its standby/hibernation/shutdown timer. Therefore, (2) would be accomplished, because recording and of course also transcoding would keep machine from hibernating. However not No. 1 because simply watching TV (withouth recording, and without sending any control remote commands means over 10% CPU)
Solution: TOff. I found out this utility which is much more powerful than windows power management. It has a simple activity timer and regardless of CPU it executes the desired "OFF" command (in my case soft hibernation) when no keyboard/mouse activity is recorded.
## Problem #1
This led to the following problem. TOff didn't care I was controlling PVRX2 with the remote control changing channels, visiting menu guide, whatever.
I'm using HIP, so there lied the problem. I was using only POST commands to send commands to PVRX2. Of course, those aren't keyboard commands, those are some kinda underground between programs commands. So I changed from POST commands to keystrokes and problem solved
## Problem #2
Now, how to prevent TOff from hibernating the computer when GBPVR is recording. What I did was I created a recordingstatus.bat file. What it does: It sets two GBPVR "stages" one is RECORDING and the other is AFTER-RECORDING. We recognize stage by the recordingstatus argument. When GBPVR starts recording the word "Recording" is passed as part of the command line argument to the recordingstatus batchfile. When it finishes, the word "Sleeping" is passed as part of the command line argument. Therefore, we detect which of those two words was received and: If on RECORDING stage, the TOff command is closed by the /closeall flag. If on AFTER-RECORDING stage, call the Toff batchfile and start the hibernation timer again.
## Problem #3
At last, how to keep program from hibernating when transcoding a recording. When GBPVR sends a movie to be transcoded, recordingstatus still receives "Sleeping" as part of the command line argument. So our current setup so far has TOff running and with no activity, it would hibernate no matter what after the timer rouns out. Solution?? Easy and within the same TOff. It has a configurable CPU level for considering CPU activity as timer resetting. I set this to 70% (ffmpeg runs over 80% almost constantly) so it is set.
## Problem #4
After hibernating, TOff closes and then when resuming there's no TOff back, so we don't have power management. Toff includes an appealing option called "Every time". This appears to work and it does work. When returning from hibernation, Toff starts again with the same settings. "Every time" means that TOff is run with the same settings every time a user logs on, just like when you return from hibernation. Problem arises when you get to the RECORDING stage of recordingstatus batchfile, it sends a /closeall signal to TOff to close the running TOff. When this happens, TOff has to know if you want TOff to start again upon another user logon or not. That means a dialog box which eliminates the automation objective. Therefore, the "Every time" option is out of question.
Solution: I use the wake.cmd file. In that file, I first send a /closeall signal to TOff (in the case that the hibernation was manual and therefore TOff wasn't closed automatically) and then call again the TOff batchfile to start the timer again.
## Manual hibernation
I didnd't spend too much time thinking about this. For me it was simple. I set the power button on the HTPC to do nothing. So when you press it, it just doesn't do anything. And I mapped the power button from the remote control to the execution of a bat file: tryhiber.bat.
If you look at the recordingstatus batchfile, you'll see that when arriving to the RECORDING stage I create c:\pvrwrkng file so that when I get "Sleeping" as command line and that file exists, it goes to AFTER-RECORDING stage.
This tryhiber.bat simple sees if the file c:\pvrwrkng exists. If it does, it doesn't hibernate. If it doesn't exist, then it goes to hibernate with a TOff command. This TOff command doesn't mess with an already running TOff command.
There are a lot of uncovered corners here:
- When transcoding it hibernates (shouldn't matter, since hibernation should return back to the point where the ffmpeg process left)
- Going to the start menu to hibernate and hibernating isn't stopped
- If you don't have the remote, you can't hibernate (doesn't matter too much to me, it hibernates after an hour automatically)
- I don't know what happens when you try to hibernate from the system submenu in pvrx2
I'm attaching Recordingstatus.bat, wake.cmd, tryhiber.bat, toff.bat and the hip file. Of course, you have to check for paths. The files are extremely short though.
About the hip file, check my other post for some clarification, it's pretty much standard with very few tweaks. Keeping it in its own post for easy finding.
For some reason E4 and E4+1 dont give me any picture tonight in live preview mode.
If I hit pause to time shift its ok, I have tried both tuners (nova t 500 and 7010ix), I tried a new version of the ATI mpeg decoder but its still the same.
I cant see anything in the logs either, I guess I'm going to have to dig into graph edit....opinions????
Logs attached go something like...e4 live tv (no picture) pause then play (ok), stop to menu then live tv channel5 (all ok).
I've searched the forums and found out how to combine epgs from the same grabber, but is there a way to combine them from different grabbers into one xmltv file? I'm using zap2it for a grabber now because it has Directv's listings, but it does not have many of the local non-network channels. When I used mc2xml, it had those channels but not Directv's so I'd like to try and combine those two. Any ideas? Thanks for your help.
My Hauppauge 45 button silver remote has 5 extra buttons on the top; TV, Videos, Music, Pictures and Radio. Is it possible to map these keys to custom commands (or standard commands) so that hey go to the TV guide, video library, music library, picture library and DVB-T radio respectively?
I understand that the remote isn't a direct control, the software sends emulated key presses to GBPVR but could this be achieved with custom menu commands? How would I go about this?
I am having a problem getting to files on one the disks that I have: I am getting a zero length string error. I can configure it to read other disks OK, I can also get to a few of the directories on this disk that I tried. But when I point it to the whole drive, it give me 0 length error.
See attachments; error info and file list and .xml
I'm looking for some full 1080p (1920x1080) content to try and stress my new build a bit. I have found the MS HD Video Showcase but all the clips are a bit short. I need something longer, preferably in H.264. Any suggestions?