clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
673 stars 176 forks source link

Add/improve bit-rate handling for transcoding and ripping #606

Closed clinton-hall closed 9 years ago

clinton-hall commented 10 years ago

From #545 Question: When converting a DVD to avi or mkv I often end up with a high bitrate media file. The same goes for some downloaded content that appears to be reasonable sized, but often has a high bitrate. ;y CPU can handle 720p transcoding without a problem, but goes into overload when transcoding high bitrate files. I noticed that most files that work well on my server have a bitrate of anywhere between 800 upto 4000-5000 (or somewhere about). But anything higher is likely to make the playback stutter.

I see ffmpeg can deal with scaling down the bitrate. Some good info I found here: http://superuser.com/questions/582198/how-can-i-get-high-quality-low-size-mp4s-like-the-lol-release-group

In your autoProcessMedia.cfg you have some presets under the [Transcoder] section. What do you suggest if I would like to set a max bitrate for all media files that get transcoded?

Is it only the bitrate I need to look at or is it a combination of the width and height and bitrate? Not sure how to optimize this. As an example I could say that following file plays without any issues on my server:

Video Resolution 720p Bitrate 4122 kbps Width 1280 Height 528

But this one does not:

Video Resolution 576p Bitrate 7587 kbps Width 720 Height 576

How does this feature interact with your # outputDefault parameter?

clinton-hall commented 10 years ago

currently, the dvd rip to mkv doesn't change the bitrate at all... it just copies the streams.

the output Defaults don't include any bitrate scaling.. I can try and add these in, Currently this is only able to be set in the custom... I'll need to have a quick look to see how this is handled as this was in the oriignal trancoder code, but hasn't specificallt been tested in the new code...

clinton-hall commented 10 years ago

ok... in autoProcessMedia.cfg

[Transcoder]
    outputDefault = mp4-scene-release

This can obviously be tweaked somewhat, but the key differences between this and the mkv default are:

  1. Creates .mp4, not .mkv
  2. Defines -crf 19 (Constant (bit)Rate Factor)
  3. Defines -level 3.1 (H.264 level)
  4. Defines -q:a 100 (audio quality)

So this should more closely mimic some "standard" scene releases...

This will be slower (than a straight stream copy) to transcode, but in the case of transcoding DVD .iso or DVD folder structures, this will reduce the filesize and bitrate to make this more easily playable by some devices...

thesatman commented 10 years ago

Great job ! Thank you for this :o). As you say, this will be slower to process. I wonder if there is a more advanced way to use this. I am thinking in terms of: If original bit rate < 5000 do nothing, if > 5000 do mp4-scene-release. Otherwise, the way I understand it, ALL files will be transcoded. Remember, this is the same issue with the other transcoding topic (join media files into 1 mkv). Right now I have disabled that feature to avoid that ALL files are converted to mkv.

clinton-hall commented 10 years ago

yeah, I can put a check in place for the current bitrate...

For the different processing for different scenarios, that will take a bit more... but I have ideas :)

thesatman commented 9 years ago
I haven't activated this feature yet. Waiting for the current bitrate test if-then-else. This isn't implemented yet, is it?

 

On Wednesday, November 5, 2014 08:52 AM CET, Clinton Hall <notifications@github.com> wrote:
 

yeah, I can put a check in place for the current bitrate...

For the different processing for different scenarios, that will take a bit more... but I have ideas :)
clinton-hall commented 9 years ago

no... I haven't done anything for the last few weeks as I have been really sick. I'll try and look into this soon.

thesatman commented 9 years ago
Hope you are all well again and feeling better.

Just got a case here where I would have had great use of the "scene" conversion. A rare gem that I only found as a BR-edition, size 11 Gb with a 12000 bitrate, DTS.

For sure this file is going to put a lot of straign on my CPU and at the very least my wireless network with Roku Streaming Stick. My settings in the Roku Plex client are set to max 2 Mbps 720p... When doing a speedtest on my Roku Stick I have an average of 5 Mbps.

 
clinton-hall commented 9 years ago

Yes, feeling much better thanks, but getting a really hard time at work (I think I need a career change).

I am hoping to spend the first week of the Holidays just being with family and doing jobs around the house. Then I want to sit down and hit this (and 2 or 3 other issues) out. So I "plan" to have something just before, or just after New Years.

Sorry for the delay, but I did a lot about 3 months back and since then I have had a lot of other stuff going on.

thesatman commented 9 years ago
Hi Clinton,

Many thanks for this new feature ! I will test it right away. Got a 6Gb BD 1080P movie on my list that can be a good test case.

So first of all, just to get this test job done right... Do I need to do a manual update first so I can edit the new config file? How do you suggest I proceed?

FYI, I have been using XMEDIA Recode for a while now. I found that following settings work best for me:

Video: convert to MKV, 1500 bitrate (I used variable bitrate, not sure about this setting) All other settings default.

Audio: copy

This way, in case of DTS audio, the total bitrate will be around 1500 (video) + 1500 (audio). In case of stereo audio >> 1500 (video) + "less then 1000". This way my Roku Streaming Stick has no issues, and my server has no transcoding problems.
 

I wish you a merry Christmas! Happy Holidays !!!
thesatman commented 9 years ago

Hi Clinton, How did things work out with the bitrate check before converting to mp4-scene? How do I put all this in my config?

thesatman commented 9 years ago

Old thread #606 is closed now and I am not sure if you are following this, so I took the liberty to open a new issue #793.

mgaulton commented 1 year ago

I'm curious, I'm wanting to mimic the mp4_scene_release settings to sickbard_mp4_automator so I can do a bulk check on my library to get a consistent media for streaming. Anyone done something like this and suggest changes to the mp4 automator config?