2020-04-10, 08:11 PM
If you replace -f rawvideo with -c:v h264_qsv does that change anything?
Martin
Martin
2020-04-10, 08:11 PM
If you replace -f rawvideo with -c:v h264_qsv does that change anything?
Martin
2020-04-10, 08:15 PM
(2020-04-10, 08:11 PM)mvallevand Wrote: If you replace -f rawvideo with -c:v h264_qsv does that change anything? That would mean that I would have -c:v h264_qsv twice in the command line and it errors out: C:\Users\argyr>"C:\Program Files\NPVR\Other\ffmpeg.exe" -init_hw_device qsv=hw -c:v h264_qsv -s:v 2560x1440 -i "http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8" -c:v h264_qsv -b:v 5M -f null NUL ffmpeg version 4.2 Copyright © 2000-2019 the FFmpeg developers built with gcc 9.1.1 (GCC) 20190807 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Option video_size not found. The minimum that works with -c:v h264_qsv in the command line is this: "C:\Program Files\NPVR\Other\ffmpeg.exe" -init_hw_device qsv=hw -f rawvideo -s:v 2560x1440 -i "http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8" -c:v h264_qsv -b:v 5M -f null NUL ffmpeg version 4.2 Copyright © 2000-2019 the FFmpeg developers built with gcc 9.1.1 (GCC) 20190807 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, rawvideo, from 'http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8': Duration: N/A, start: 0.000000, bitrate: 1105920 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 2560x1440, 1105920 kb/s, 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_qsv)) Press [q] to stop, [?] for help Output #0, null, to 'NUL': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (h264_qsv), nv12, 2560x1440, q=-1--1, 5000 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc58.54.100 h264_qsv Side data: cpb: bitrate max/min/avg: 0/0/5000000 buffer size: 0 vbv_delay: -1 frame= 6 fps=0.1 q=51.0 Lsize=N/A time=00:00:00.20 bitrate=N/A speed=0.00472x video:3729kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown I hope that makes sense...
2020-04-10, 08:36 PM
Trying to read a bit about ffmpeg....
as per: https://www.ffmpeg.org/ffmpeg.html#AVOptions -hwaccel[tream_specifier] hwaccel (input,per-stream) Use hardware acceleration to decode the matching stream(s). The allowed values of hwaccel are: .... .... qsv Use the Intel QuickSync Video acceleration for video transcoding. Unlike most other values, this option does not enable accelerated decoding (that is used automatically whenever a qsv decoder is selected), but accelerated transcoding, without copying the frames into the system memory. For it to work, both the decoder and the encoder must support QSV acceleration and no filters must be used. This option has no effect if the selected hwaccel is not available or not supported by the chosen decoder. Note that most acceleration methods are intended for playback and will not be faster than software decoding on modern CPUs. Additionally, ffmpeg will usually need to copy the decoded frames from the GPU memory into the system memory, resulting in further performance loss. This option is thus mainly useful for testing. If that is the case, isn't the right thing to do to read the stream in raw format (i.e. -f rawvideo ) and only specify the output format, so only transcode as the output shows? Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_qsv))
The original command from NextPVR that Martin listed, works if I do the following changes:
1. add -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 2. change -map 0:a:0 to -map 0:a:0? "C:\Program Files\NPVR\Other\ffmpeg.exe" -y -hwaccel:v:0 d3d11va -hwaccel_device:v:0 0 -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 -i "http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8" -map_metadata -1 -threads 0 -ignore_unknown -map 0:v:0? -map 0:a:0? -map -0 -codec:v:0 h264_qsv -b:v 1500000 -maxrate 1500000 -bufsize 3000000 -codec:a:0 aac -strict experimental -ac 2 -ab 128000 -f null NUL Output: libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, rawvideo, from 'http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8': Duration: N/A, start: 0.000000, bitrate: 622080 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc [AVHWDeviceContext @ 062d8b00] Using device 8086:22b0 (Intel® HD Graphics). Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_qsv)) Press [q] to stop, [?] for help Output #0, null, to 'NUL': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (h264_qsv), nv12, 1920x1080, q=-1--1, 1500 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc58.54.100 h264_qsv Side data: cpb: bitrate max/min/avg: 1500000/0/1500000 buffer size: 3000000 vbv_delay: -1 frame= 4 fps=0.3 q=51.0 Lsize=N/A time=00:00:00.12 bitrate=N/A speed=0.00986x video:55kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Exiting normally, received signal 2. I don't know if that means anything @Sub
2020-04-10, 09:27 PM
(This post was last modified: 2020-04-10, 09:42 PM by mvallevand.)
There seems to be something wrong with the Windows h/w settings Kodi since I am not seeing the profile size even being used like I do with my linux system.
I also confirmed that -c:v ### for the decoder does make a difference for hw/decoding but it is dependent on the stream which is probably why sub doesn't use it. Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv)) Martin
2020-04-10, 09:43 PM
(2020-04-10, 09:27 PM)mvallevand Wrote: There seems to be something wrong with the Windows h/w settings Kodi since I am not seeing the profile size even being used like I do with my linux system. Hi Martin, This one I am not trying from Kodi, I am trying from the default NextPvr webpage
2020-04-10, 09:50 PM
The browser seems to be broken for using transcoding profiles too.
Martin
2020-04-10, 09:56 PM
Thought I'd show an interesting link comparing 1) hw decoding and encoding 2_- sw decoding w hw encoding (nextpvr transcoding) 3 sw decoding (nextpvr default)
https://imgur.com/a/oG2oaQS Martin
This command also seems to be working and using GPU (18%):
"C:\Program Files\NPVR\Other\ffmpeg.exe" -init_hw_device qsv=hw -filter_hw_device hw -i "http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8" -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -q 25 -f null NUL Note that CPU is 100% because on the same machine I am also running folding@home client.
Original command also works if I add:
-hwaccel_device:v:0 0 -init_hw_device qsv=hw -filter_hw_device hw and -vf hwupload=extra_hw_frames=64,format=qsv "C:\Program Files\NPVR\Other\ffmpeg.exe" -y -hwaccel:v:0 d3d11va -hwaccel_device:v:0 0 -init_hw_device qsv=hw -filter_hw_device hw -i "http://127.0.0.1:8866/live?channeloid=7562&transcoder=3f149498-ce76-492c-a394-c0b2ab103364&client=5c53419a-db74-43eb-b730-b60c7506a7e8" -map_metadata -1 -threads 0 -ignore_unknown -map 0:v:0? -map 0:a:0? -map -0 -codec:v:0 h264_qsv -b:v 1500000 -maxrate 1500000 -bufsize 3000000 -codec:a:0 aac -strict experimental -ac 2 -ab 128000 -vf hwupload=extra_hw_frames=64,format=qsv -f null NUL and it uses 19% CPU and 26% GPU |
|