lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

Changing bitrate manually #288

Closed genimac closed 5 years ago

genimac commented 5 years ago

My first question :) I have some users on my Plex server that had bad internet access. The server can transcode but thats no the problem, looking the logs I find they always ended at 1.5mbps SD. Plex optimised on some worked and they start getting direct play at 720p if the bitrate was less than 1.5, over that they transcode again. I want to make a 720p that can direct play on them as Plex one usually is over their limit and go full down to SD. I alone with the Handbrake presets can't so I start googling and found your tool. Did a hurry test and your tool beat Plex by far. I used transcode-video --mp4 --720p --main-audio 2 --burn-subtitle 1 done/\[Man.K\]Hachimitsu_to_Clover_S1_-_01_\(Dual\ Audio_10bit_BD1080p_x265\).mkv It ended on the limit

Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (isom/iso2/avc1/mp41) File size : 260 MiB Duration : 22 min 35 s Overall bit rate : 1 611 kb/s Encoded date : UTC 2019-07-10 17:06:18 Tagged date : UTC 2019-07-10 17:06:18 Writing application : HandBrake 1.2.2 2019062000

On the help options y saw the option --target [2160p=|1080p=|720p=|480p=]BITRATE and then I tried transcode-video --mp4 --target 720p=1100 --main-audio 2 --burn-subtitle 1 done/\[Man.K\]Hachimitsu_to_Clover_S1_-_01_\(Dual\ Audio_10bit_BD1080p_x265\).mkv But the file keep the original 1080p format and doubled the size. What do I need to change to get a 720p version at 1200 to be on their safe zone? From the test also learned that no matter if there is only one sub, if its not forced its not burn by default. Thanks in advance and sorry If I'm not clear or use wrong terms.

samhutchins commented 5 years ago

transcode-video has several "ratecontrol" systems, and you can read more about them here: https://github.com/donmelton/video_transcoding#explanation

The default system is treats the target bitrate as something of a guideline, and it will go over it to achieve a certain minumum quality. I think this is what you're seeing, the 1100 limit is just too low for the default system to maintain the quality it aims for.

There are 2 systems that don't have this behaviour:

  1. --simple
  2. --abr

--simple treats the target bitrate as a hard limit, and it will never go above it. --abr treats it as a slightly softer limit, and will go above it for brief moments, but will always stay within the limit on average.

I'd try --abr first, and if that doesn't work for you try --simple

For example:

transcode-video --abr --mp4 --target 720p=1100 --720p --main-audio 2 --burn-subtitle 1 done/\[Man.K\]Hachimitsu_to_Clover_S1_-_01_\(Dual\ Audio_10bit_BD1080p_x265\).mkv

or

transcode-video --simple --mp4 --target 720p=1100 --720p --main-audio 2 --burn-subtitle 1 done/\[Man.K\]Hachimitsu_to_Clover_S1_-_01_\(Dual\ Audio_10bit_BD1080p_x265\).mkv

The other thing I notice in the commands you gave is that you removed --720p when you specified the target bitrate, and this is why the output was still 1080p for that. You need to specify both --target 720p=1100 and --720p. The --target option only changes the target bitrate, and when you specify --target 720p=1100, it;s only changing the target bitrate for 720p output. --720p is what tells the tool out output 720p


For setting the "forced" flag on subtitle tracks before you transcode them (so you don't need to specify it in the transcode-video command), you can use mkvtoolnix-gui. It has a "Header editor" mode:

Capture

You can use this to change the flags, then go to "Header editor -> Save (Ctrl+S)" in the menu to save your changes

genimac commented 5 years ago

Thanks a lot, I'm testing right now with abr as it seems the best fit from your explanation. Noted I need to specify 720p on both options. (that one must have figured) The sub is no problem, as before doing anything I always check the source and then do a little script to batch all the serie. The final goal is to remake all my libraries content and get a 1080p good version for the most friends and a "fair" 720p for the few with internet limits. I will edit when I have the test done so you know :)

lisamelton commented 5 years ago

@samhutchins Thanks so much for your answer while I was AFK!

genimac commented 5 years ago

result:

Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (isom/iso2/avc1/mp41) File size : 186 MiB Duration : 22 min 35 s Overall bit rate mode : Variable Overall bit rate : 1 153 kb/s Encoded date : UTC 2019-07-10 20:29:45 Tagged date : UTC 2019-07-10 20:29:45 Writing application : HandBrake 1.2.2 2019062000

And they direct stream it! Is much loosed using these line against thetranscode-video --mp4 --720p --main-audio 2 --burn-subtitle 1. I mean any much difference if I fine-tune it trying to get a nearer theit limit say 1.4?

samhutchins commented 5 years ago

@donmelton No problemo

@genimac

Woo! I'm glad that worked. You could certainly try 1400. The differences in quality may be quite subtle, but a higher bitrate will almost certainly result in higher quality

genimac commented 5 years ago

@samhutchins Thanks again for your prompt help. For the people with bad internet and the tests we did we had: 1- best quality, direct play, video-transcoding to 720p as your first suggestion (I will no go up 100 on each try until hit their limit) 2- Plex optimize for Android 2mbps (resulta have different bitrate at end from 1400 to 2050 some direct play, some transcode to 720p) 3- Plex transcoding SD 1,5mbps (no way we could transcode to any 720p)

@donmelton Man, you have quite a site. Here a fine group of people quick at hands to help. And your web page... I start reading and get it all non-stop :) You know we share some similarities, I also work at computers by autolearning. I was 2 assignatues from ending Chemical Engineering but dropped because we had the oportunity to start a computer shop with my brother. Guess what, we sold Apple IIe, and then the magic Macintosh in 1984. Been with the Fruit Company since then, enjoying and suffering the time until Jobs return and start the iMac line. Thats a long way since my father programable HP 65-C, my Sharp 1210, my Acorn Atom with the BBC Basic ROM that i build from kit, and then my long standing SE-30, iMac Lime.... Being able to read things from the inside perspective was wonderful. Also we also have the same love for dogs, so much they give for so less. Now that I can't drive I moved to cats, not the same but also they have good points.

Sorry maybe I go to long, if there is a closed tag, this can be closed.