Jump to content

Recommended Posts

zaHrecsohbiw
Posted

When creating a rule for automatic conversion to apply to a folder, is there a way to use original bitrate if the bitrate is below a defined threshold? For instance, I'd like to convert all media that shows up in a specific folder to HEVC, and I would like to set an upper limit bitrate of 4mpbs. So, if the bitrate is lower than 4mpbs, it's converted at original bitrate, but if the bitrate of the original media was, say, 12 mbps, I'd like to to be reduced to 4mpbs during the conversion process. 

  • 2 weeks later...
Posted

Hi @zaHrecsohbiwthat's what it should already do. Did you try setting a custom bitrate of 4 mbps when setting up the conversion job?

zaHrecsohbiw
Posted

@LukeI apologize for not responding sooner. I have a large batch job running now and will pay close attention in the following days and see if I can produce a concrete example of a low bitrate file getting converted to a higher bitrate. Yes, the batch job is one with custom settings. 

 image.png.d6d1f7d74203ad6f7dad151ab2e83434.png

  • 2 weeks later...
zaHrecsohbiw
Posted
29 minutes ago, Luke said:

OK @zaHrecsohbiwplease let us know how this goes. Thanks.

I’m sorry @Lukei haven’t really paid as much attention to this as I should have.

I just wrapped up converting ~2500 files to mkv(hevc/aac) and basically had three categories of output:

1) (the vast majority) have been at or below the bit rate limit I entered, and the quality is generally acceptable. I don’t always understand the relationship between avc bitrate input and hevc bitrate output, but it’s nothing that I would complain about, as I am prioritizing storage efficiency over any other detail,

2) have been low bitrate in & out, but the output is larger than the input (just one of those things I guess), and

3) files that were high bitrate input and aggressively compressed & low bitrate on the output. This last category really confuses me.

all of these files were done with a single convert task applied to an entire library, with custom settings of mkv, hevc, aac, 4 mbps. 

to be honest though, I don’t think your software has done anything wrong here. This could all be up to my hardware and driver preferences (Intel, using QSV. I disabled all VAAPI options.) in my case the hevc qsv encoder doesn’t have any tunable parameters so it’s likely that this is all just the nature of the beast. 
 

it could perhaps be the case that some low bitrate files did somehow manage to go from <1 mbps to >=1 mbps, but I just did not spend enough time collecting file info before I let the task complete to be able to provide a meaningful example. 
 

If there is a way for me to “close” this as an issue, I’ll be happy to do so.

  • 1 month later...
Posted
Quote

3) files that were high bitrate input and aggressively compressed & low bitrate on the output. This last category really confuses me.

Hi, can we please look at a specific example? Thanks.

zaHrecsohbiw
Posted
35 minutes ago, Luke said:

Hi, can we please look at a specific example? Thanks.

please see attached; input file is 14mbps, output file is 1mbps, conversion settings are hevc/aac/original quality. unfortunately the same thing happened to the vast majority of my files. im not sure that I still have the embyserver log for this specific conversion instance.

relevant-conversion-settings.png

ffprobe-of-converted-file.txt ffmpeg-transcode-f35416ac-fd86-4c2f-8c27-594fe67c4fc7_1.txt

zaHrecsohbiw
Posted (edited)

@LukeSorry I forgot to mention yesterday that I also had the same results when setting a custom bitrate of 4mbps. I haven't inspected every graph file certainly, but the encoder side seems to always use the default bitrate of 1536kb/s. nm that's the audio bitrate; I wasn't being thorough enough before I posted this. 

 

but:
03:53:56.574   Stream #0:0: Video: hevc, qsv(tv, bt709, progressive), 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 1000 kb/s, 23.98 fps, 1k tbn (default)

Edited by zaHrecsohbiw
im an idiot
Happy2Play
Posted

Potentially need to see ffmpeg logs as there is a difference in Software and Hardware conversions if I remember correctly.

zaHrecsohbiw
Posted
Just now, Happy2Play said:

Potentially need to see ffmpeg logs as there is a difference in Software and Hardware conversions if I remember correctly.

did I not post the ffmpeg log?

Happy2Play
Posted
1 minute ago, zaHrecsohbiw said:

did I not post the ffmpeg log?

Sorry scrolled right past it.  As maxrate is configure but 

-maxrate:v:0 9627124 -bufsize:v:0 19254248

03:53:56.574     Side data:
03:53:56.574       cpb: bitrate max/min/avg: 9627124/0/1000000 buffer size: 19254248 vbv_delay: N/A

As you see above there is no minimum bitrate to start from and looks like it never goes higher than 1278.0kbits/s

04:32:57.867 elapsed=00:39:01.35 frame=231491 fps= 99 q=-0.0 size= 1506304kB time=02:40:55.10 bitrate=1278.0kbits/s throttle=off speed=4.12x 

 

Now if you tested without HWA you see a minimum bitrate, correct?

 

Pretty sure this has come up before but devs will have to explain the logic here as you do not get your set 4Mbps value in HWA.

  • Like 1
zaHrecsohbiw
Posted
19 minutes ago, Happy2Play said:

Sorry scrolled right past it.  As maxrate is configure but 

-maxrate:v:0 9627124 -bufsize:v:0 19254248

03:53:56.574     Side data:
03:53:56.574       cpb: bitrate max/min/avg: 9627124/0/1000000 buffer size: 19254248 vbv_delay: N/A

As you see above there is no minimum bitrate to start from and looks like it never goes higher than 1278.0kbits/s

04:32:57.867 elapsed=00:39:01.35 frame=231491 fps= 99 q=-0.0 size= 1506304kB time=02:40:55.10 bitrate=1278.0kbits/s throttle=off speed=4.12x 

 

Now if you tested without HWA you see a minimum bitrate, correct?

 

Pretty sure this has come up before but devs will have to explain the logic here as you do not get your set 4Mbps value in HWA.

I will check software transcoding later today and report back. Related, this may not have been a problem with VAAPI, but I had so much trouble with that driver that I had to switch to QSV. One of the many reasons that it took me a long time to recognize this as an issue is likely because I transcoded many files with VAAPI first.

Happy2Play
Posted

Don't know it will matter but can you update to the current release 4.8.10.0 also.

zaHrecsohbiw
Posted
Just now, Happy2Play said:

Don't know it will matter but can you update to the current release 4.8.10.0 also.

This log is from before I updated, but I have since updated to 4.8.10.0 and the problem persists. I just happened to already have this issue saved on my computer. Unfortunately, I have a folder full of emby issues that I have saved files for. I love this software, but it's also brought me closer to insanity than almost anything ive ever used lol.

zaHrecsohbiw
Posted

https://ffmpeg.org/ffmpeg-codecs.html#toc-Ratecontrol-Method

9.26 QSV Encoders

The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG, VP9, AV1)

9.26.1 Ratecontrol Method

The ratecontrol method is selected as follows:

  • When global_quality is specified, a quality-based mode is used. Specifically this means either
    • - CQP - constant quantizer scale, when the qscale codec flag is also set (the -qscale ffmpeg option).
    • - LA_ICQ - intelligent constant quality with lookahead, when the look_ahead option is also set.
    • - ICQ – intelligent constant quality otherwise. For the ICQ modes, global quality range is 1 to 51, with 1 being the best quality.
  • Otherwise when the desired average bitrate is specified with the b option, a bitrate-based mode is used.
    • - LA - VBR with lookahead, when the look_ahead option is specified.
    • - VCM - video conferencing mode, when the vcm option is set.
    • - CBR - constant bitrate, when maxrate is specified and equal to the average bitrate.
    • - VBR - variable bitrate, when maxrate is specified, but is higher than the average bitrate.
    • - AVBR - average VBR mode, when maxrate is not specified, both avbr_accuracy and avbr_convergence are set to non-zero. This mode is available for H264 and HEVC on Windows.
  • Otherwise the default ratecontrol method CQP is used.

Note that depending on your system, a different mode than the one you specified may be selected by the encoder. Set the verbosity level to verbose or higher to see the actual settings used by the QSV runtime.

Posted

I think I have the same behaviour here. Setting 4Mbps in a custom HEVC conversion means an output file of roughly 1mbps or below. The target bitrate is never reached. I don't know why and that's preventing me to use this function at all. 

  • Agree 1
  • 2 months later...
Posted

@zaHrecsohbiwdid you try software encoding to see how things compare?

zaHrecsohbiw
Posted
On 1/1/2025 at 9:33 PM, Luke said:

@zaHrecsohbiwdid you try software encoding to see how things compare?

Happy New Year, Luke! No, I have not tried software encoding, even though I see here that I said I would try it. I suspect that it would work fine, but I will give it a shot and let you know for certain.

I've been relying on Handbrake (on the same machine) for converting my media. The h265 QSV profile in Handbrake does work as expected. I haven't spent any time debugging this issue since my last message on this thread, so I suppose I am still of the opinion that the ffmpeg command string is missing a required argument for qsv to work as intended, but I am happy to dive back in if you'd like to have more data, or if you think that it is _not_ related to the missing bitrate argument.

On 10/12/2024 at 8:11 AM, zaHrecsohbiw said:

https://trac.ffmpeg.org/wiki/Hardware/QuickSync

when I look at the ffmpeg command, it has no b:v <bitrate> arg, which I think may be necessary given how the rest of the command is structured? 

zaHrecsohbiw
Posted
On 1/1/2025 at 9:33 PM, Luke said:

@zaHrecsohbiwdid you try software encoding to see how things compare?

Ok I just tried software encoding and converted a 4k/21mbps file to 1080p/5mbps, so that's a successful conversion.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...