fHDHR / fHDHR_plugin_origin_ceton

Do What The F*ck You Want To Public License
1 stars 4 forks source link

Add status information and method, to api #34

Closed arrmo closed 2 years ago

DanAustinGH commented 2 years ago

I am 95% sure I will merge this as is. I kind of prefer to set baseline values explicitly during init and not depend on another function to do it, but you method avoids redundant code and handles the external case.

arrmo commented 2 years ago

100% your call! And funny as it is - was just pushing a minor update as your post rolled in => slight tweak, added "scan" mode for the api ... checks all tuners, doesn't stop on one being available. Tested it with the Ceton UI, RTP on and off for Tuner 4 ... detects it.

Thanks!

PS: can't wait for your PCIe 6 card ... hoping this all works great for you!

DanAustinGH commented 2 years ago

Just had a chance to look at it the small tweak. I can live with the way the code works. Going to merge.

arrmo commented 2 years ago

Thanks! And as always, scream if you see issues in your setup. Will fix any problems 👍

arrmo commented 2 years ago

BTW, if you have the urge, check out (and comment on!) https://github.com/arrmo/fHDHR/tree/hwaccel https://github.com/arrmo/fHDHR_plugin_stream_ffmpeg/tree/hwaccel

Using it here - hevc HW accel running, so I reduce the BW to my "clients" (i.e. VLC, Plex, etc.). And no Plex postprocessing script, to get my HDD space back ... LOL!

DanAustinGH commented 2 years ago

Sweet. I started to look a few days back, but the profiles were all reducing resolution, so I did not actually test. The custom HVEC profile definitely is something I will want to play with...

arrmo commented 2 years ago

All but the last one were already in the code - I just kept them. I have been fiddling here with the "custom" profile. And it's set up that if you set that in config.ini ... the file is read whenever ffmpeg is started. So no need to restart fhdhr => just change parameters, stop and restart your stream, and new parameters are in use.

arrmo commented 2 years ago

FYI, couple interesting notes ... https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/ https://www.reddit.com/r/ffmpeg/comments/euiwtv/scale_cuda_vs_scale_npp/

arrmo commented 2 years ago

BTW, one little thing I still want to figure out => nvenc is limited, to 3 simultaneous instances. So after that ... fallback to SW encoding. I can see a way to do it, looping through codecs, but that seems a bit ugly to me. Not sure if there is a better way, to know when there are no GPU engines left. Something to noodle on 😜

DanAustinGH commented 2 years ago

Have you patched you Nvidia drivers? I have a low-end 1650 (no fans or additional power connector) and with the patch it is rumored to be good for a dozen or so HD transcodes.

arrmo commented 2 years ago

No, haven't heard about that - got any more info! I have an even lower end 960 ... LOL. But the 3 I was referring to comes from here. Perhaps though this is a SW limited stop? Does seem odd to me that all the way to a 3090 the limit is the same?

DanAustinGH commented 2 years ago

Nvidia limits lower end devices to I thought 2. The patch is on github, google 'nvidia driver patch' There are a list of supported drivers, and a patch script. If it falls back cleanly to software, then adding a warning to the docs that the user needs to know their system limits. We could track in in tunerstatus and skip transcoding if we exceed official limits, but I'm not really in favor of that.

arrmo commented 2 years ago

Will check for that, thanks! But I do find that I get to 3 ... just not to 4 (tuner count) - and that seems to match Nvidia info?

We could track in in tunerstatus and skip transcoding if we exceed official limits, but I'm not really in favor of that.

Yes, agreed. I'd like to fall back to another transcoding (e.g. libx265), if no GPU HW left. => use the GPU until full, then CPU.

arrmo commented 2 years ago

You had it right! Check this out, https://www.tomshardware.com/news/patch-boosts-video-encoding-for-nvidias-consumer-gpus => and, https://github.com/keylase/nvidia-patch

Checked it, running 8x parallel encodes right now 🕺. No need for a fallback!

DanAustinGH commented 2 years ago

And there is no magic in the patch. It simply removes a static limit in the code from Nvidia, and that limit was there just to encourage people to buy the 3x more expensive Pro card...

arrmo commented 2 years ago

That's crazy, just in some firmware. Thanks for the pointer!

arrmo commented 2 years ago

BTW, when you have HW encoding going on, just me - or do you always get 0 from this?

nvidia-smi --query-gpu=encoder.stats.sessionCount --format=csv,noheader

Thanks!

DanAustinGH commented 2 years ago

I planned to use HW acceleration, but all my devices are high bandwidth and have modern codec support, so I almost never actually have the system transcoding. I do recall early on while testing that just 'nvidia-smi' would indicate that there were active sessions. I'll try and setup a test to force transcoding and see what happens...

DanAustinGH commented 2 years ago

And with very limited testing, yes I get zero. Even when just nvidia-smi indicates there is a session...

arrmo commented 2 years ago

And with very limited testing, yes I get zero. Even when just nvidia-smi indicates there is a session...

OK, thanks! They say that nvidia-smi may be limited. I do find that telegraf will capture utilization, that works as well 😄

I'll try and setup a test to force transcoding and see what happens

If you want, let me push my latest updates to my repository - then you can try those out.

arrmo commented 2 years ago

OK, updated. You need to pull top level (fHDHR), and the ffmpeg plugin if you want to check out the updates. And once fHDHR is up and running => if you change transcode.json, it will take effect on the next ffmpeg start (i.e. "dynamically" reads the file, on ffmpeg startup).

If you don't specify a transcoding, or remove transcode.json => it just falls back to the original default (copy).

Thanks!

DanAustinGH commented 2 years ago

Thanks, will take a look on Monday...

arrmo commented 2 years ago

No panic. Have a nice weekend!

arrmo commented 2 years ago

And also a question - no panic here as well! I'm looking to add channel + SNR to the API => I use it to write to influx, then get a daily report. If SNR degrades, go check cables, etc.

Add that info to the current status method, or add a new method? I'm good with either, whatever you prefer.

Thanks!

DanAustinGH commented 2 years ago

If you mean adding those to the tunerstatus dict, then yeah that is a reasonable bit of into to include there...

arrmo commented 2 years ago

Exactly! Will do.

arrmo commented 2 years ago

Done! #39

Thanks!