NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) Old Stuff (Legacy) GB-PVR Support (legacy) v
« Previous 1 … 147 148 149 150 151 … 1231 Next »
H.264 encoding

 
  • 0 Vote(s) - 0 Average
H.264 encoding
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#1
2009-03-05, 01:03 AM (This post was last modified: 2009-03-05, 01:09 AM by elmede.)
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:

Code:
<Conversion name="H.264" cmd="-y -i {SOURCE_FILE} -threads 2 -vcodec h264 -b 1200k -flags +loop -cmp +chroma -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -crf 22 -me umh -subq 7 -trellis 1 -g 250 -keyint_min 25  -i_qfactor 0.71 -bt 142282 -rc_eq &quot;blurCplx^(1-qComp)&quot; -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -acodec mp3 -ar 44100 -ab 128k {DEST_FILE}" targetExtension=".avi" />

<Conversion name="H.264" cmd="-y -i {SOURCE_FILE} -threads 2 -vcodec h264 -b 1200k -flags +loop -cmp +chroma -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -crf 22 -me umh -subq 7 -trellis 1 -g 250 -keyint_min 25 -i_qfactor 0.71 -bt 142282 -rc_eq &quot;blurCplx^(1-qComp)&quot; -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -acodec mp3 -ar 44100 -ab 128k {DEST_FILE}" targetExtension=".avi" />

(Included twice on purpose)

Just now I notice that I missed the following part from reddwarf's proposal:

-trellis 1 -refs 6 -bf 16 -directpred 3 -b_strategy 1 -bidir_refine 1 -coder 1 -me_range

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 &quot; 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.

Well that's it.. any comments??

El Mede
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#2
2009-03-05, 06:31 AM (This post was last modified: 2009-03-05, 06:35 AM by pBS.)
ffdshow codec plays it as avi.....Smile no mods/renaming needed... [i'm using beta6]
but i notice it's not deinterlaced...
you may need to add -deinterlace to ffmpeg line get rid of interlacing and improve the compression rates..
avi is mostly progressive so best not to deinterlace in decoder...
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Reddwarf
Offline

Posting Freak

Posts: 6,629
Threads: 230
Joined: Mar 2007
#3
2009-03-05, 08:59 AM
My converted .avi files plays very nice in gbpvr as avi, no renaming needed. Try to replace the "-b 1200" with "-crf 22", that should decrease the filesize, but the processing time may increase. I'v not seen any decrease of quality since I did that, but processing time went up...

"I'd rather have a bottle in front of me than a frontal lobotomy"
HtV
Offline

Posting Freak

Posts: 3,470
Threads: 46
Joined: Dec 2005
#4
2009-03-05, 09:03 AM
Quote:I have run lots and lots of tests. Lots of them. This darn H.264 encoders/decoders are really picky. They wouldn't play

Maybe you have to add: "Vtag H264" to the commandline. That way it's easier recognised as h264.

Hans
AMD Athlon 64 3000, HDD: 80, 120, 200 GB, Hauppauge 350 + 150, MVP, Asus 6000L Laptop client, Asus X50sl client,
Fritz!box 7140 modem/router, GBPVR 1.3.7.
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#5
2009-03-12, 11:48 PM
HTV: I tried adding the Vtag and didn't make much difference.. Thanks for the tip!

Reddwarf: I still don't get your sizes! I don't know what I'm doing different.. Your postprocessing right?? Because I'm working with config.xml and letting gbpvr handle everything internally.. Could you post the exact command line u're using?? Also, Are you using ffmpeg.exe from the stock gbpvr distribution??

pBS: I tried deinterlacing and sure got sizes down!!! However, the quality also got down :S.. Noticeably.. Mostly, subtitles (I'm Mexican, all american shows here have subtitles) are greatly pixelated.. so I'm back to not deinterlacing.. It's bigger files, but great quality.. Is this supposed to happen?? Or am I doing something wrong?? Because all I changed from one command line to the next was the -deinterlace flag

Thanks a lot for the input..

El Mede
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#6
2009-03-12, 11:49 PM
Ohh, forgot to add the most important part!!

PBS: Thanks for the ffdshow tip!!!!

Indeed, ffdshow plays it as an avi without further modding!! I just had to remove a bunch of AAC decoders, and some from MediaPlayerClassic Home Media, and also the arksoft... In the end, I removed almost everything I had added before, and ffdshow got it playing right!!

Thanks for that, man!!

El Mede
Reddwarf
Offline

Posting Freak

Posts: 6,629
Threads: 230
Joined: Mar 2007
#7
2009-03-13, 10:08 AM
Well the size of a converted show depends on the content, documentarys with mostly scenic landscapec and not much movment yields smaller files while action-movies with lots of movment and details increases the file size. A typical episide of "Fringe" varies from 440k to 650k in sixe in my setup. My ffmpeg has version no 4.0.3 from 2006.

Hope this helps.

"I'd rather have a bottle in front of me than a frontal lobotomy"
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#8
2009-04-02, 11:04 PM
the 'proper' way to really decrease file size without much loss is to make it into a progressive video, much like the quality/size you get from dvd's..

for this, mencoder is much better as it lets you have more control over input options and filters...tho it's not perfect if encoding ntsc tv with changing framerates, tho it does do a pretty good job...[some scenes with not as smooth motion,usually commercials]
you'll have to play with settings to get your best look with the content you're using...
basically it makes the 30fps video back into a 24fps, meaning about 25% off the top for free...Smile
using inverse telecine and skipping,etc. to intelligently cut it down to the actual changing frames only, discarding duplicates...
all the methods available have their quirks, but some are pretty smart about it..
i use : -vf filmdint,softskip on dvd's but i know they are all progressive film sources telecined to go on 29.97 dvd's...
look into the suggestions on mencoder man page about the deinterlacers..
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  XMLTV import with UTF encoding fails (also valid for NPVR) miniGranis 4 2,243 2011-01-29, 08:16 PM
Last Post: miniGranis
  Resolution Issues when re-encoding captured video bgrieb 5 2,845 2010-11-02, 03:52 AM
Last Post: mvallevand
  Hauppauge WinTV-HVR-2250 encoding at 720x480 DragonM15 5 2,221 2009-11-13, 10:40 PM
Last Post: sub
  Analog card with hardware encoding? Cydewinder 6 2,635 2009-10-30, 04:44 PM
Last Post: OrakelJos
  built in encoding que tvshowman 2 1,441 2009-10-06, 06:28 AM
Last Post: tvshowman
  Encoding .MPG Files To .AVI XviD Files Using HandBrake BTJustice 2 4,687 2009-07-08, 09:52 PM
Last Post: BTJustice
  H.264 Encoding BTJustice 9 3,328 2009-03-05, 01:04 AM
Last Post: elmede
  USB capture device with hardware encoding TomR 8 2,357 2009-01-16, 04:51 PM
Last Post: Carlito
  Post Processing/Encoding Not Working BTJustice 44 8,813 2008-12-07, 09:25 PM
Last Post: BTJustice
  2250 SVideo2 Audio and Encoding Bitrate elbowlaker 0 1,093 2008-11-16, 08:09 PM
Last Post: elbowlaker

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode