Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-14 Thread Carl Eugen Hoyos
Hi! 2016-09-08 19:34 GMT+02:00 Nicolas George : > Still, it is probably possible to do something faster than xcbgrab while > still correct: only allocate a new segment if the first one is still in use. Will you try this? Thank you, Carl Eugen ___ ffmp

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-12 Thread Andy Furniss
Andy Furniss wrote: I do know that I have really grabbed and encoded 1080p60 with my AMD h/w and including nv12 conversion gives a sane looking result - gst-launch-1.0 -f ximagesrc use-damage=0 startx=0 starty=0 endx=1919 endy=1079 num-buffers=1000 ! queue ! videoconvert ! video/x-raw,framerat

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Andy Furniss
Andy Furniss wrote: Nicolas George wrote: I had an inkling that it was about the packet -> frame conversion, but it seems rawdec does the right thing in this particular case. Still, I suggest you add a quick debug av_log() in libavcodec/rawdec.c to check that need_copy is false. I shall have

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Andy Furniss
Sven C. Dack wrote: I'd be more interested in grabbing the desktop synchronous to the display refresh rate at this point. 60Hz is a key mark, going above it not so much. What would be the next mark anyway? 100Hz? That would be good - I am in a different situation to you though, in that my h/w

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Andy Furniss
Nicolas George wrote: Le quintidi 25 fructidor, an CCXXIV, Andy Furniss a écrit : Looking into this more with sysprof it seems with this test gstreamer is twice as fast because it doesn't copy from shm but ffmpeg does. Of course I may be misunderstanding, but >90% load according to sysprof is _

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Sven C. Dack
On 10/09/16 18:35, Andy Furniss wrote: Andy Furniss wrote: With gstreamer 1080p I can get around 350 fps testing like - gst-launch-1.0 -f ximagesrc use-damage=0 startx=0 starty=0 endx=1919 endy=1079 num-buffers=5000 ! queue ! videoconvert ! video/x-raw,framerate=500/1,format=BGRx ! fakesink S

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Nicolas George
Le quintidi 25 fructidor, an CCXXIV, Andy Furniss a écrit : > Looking into this more with sysprof it seems with this test gstreamer is > twice as fast because it doesn't copy from shm but ffmpeg does. > > Of course I may be misunderstanding, but >90% load according to sysprof > is __memcpy_sse2_un

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-10 Thread Andy Furniss
Andy Furniss wrote: With gstreamer 1080p I can get around 350 fps testing like - gst-launch-1.0 -f ximagesrc use-damage=0 startx=0 starty=0 endx=1919 endy=1079 num-buffers=5000 ! queue ! videoconvert ! video/x-raw,framerate=500/1,format=BGRx ! fakesink Setting pipeline to PAUSED ... Pipeline i

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Andy Furniss
Sven C. Dack wrote: On 08/09/16 15:17, Andy Furniss wrote: Carl Eugen Hoyos wrote: 2016-09-08 12:01 GMT+02:00 Andy Furniss : I don't know what it is about x11grab/CSC with ffmpeg, but on my old CPU gstreamer is twice as fast. x11grab or xcb? I guess xcb as I don't --enable anything relate

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Nicolas George
Le tridi 23 fructidor, an CCXXIV, Carl Eugen Hoyos a écrit : > xcb is slower? Looking at the code, I see that xcbgrab allocates and frees the shared memory segment for each frame, while x11grab only allocates it once at the beginning. xcbgrab does that so that it can wrap the segment in a refcount

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Andy Furniss
Carl Eugen Hoyos wrote: 2016-09-08 19:16 GMT+02:00 Andy Furniss : It is a bit faster xcb is slower? Yes (unless I am mixing things up) --disable-libxcb --enable-x11grab is faster than autodetect ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Carl Eugen Hoyos
2016-09-08 19:16 GMT+02:00 Andy Furniss : > It is a bit faster xcb is slower? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Andy Furniss
Carl Eugen Hoyos wrote: 2016-09-08 16:17 GMT+02:00 Andy Furniss : Carl Eugen Hoyos wrote: 2016-09-08 12:01 GMT+02:00 Andy Furniss : I don't know what it is about x11grab/CSC with ffmpeg, but on my old CPU gstreamer is twice as fast. x11grab or xcb? I guess xcb as I don't --enable anythin

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Carl Eugen Hoyos
2016-09-08 16:52 GMT+02:00 Sven C. Dack : > X11grab is here only the input device. Of course. I know that and I assume Andy also knows. Still Andy claims that (our) xcb input is slower than GStreamer's x11 input and I would like him to test if the reason is our change to xcb. Carl Eugen ___

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Sven C. Dack
On 08/09/16 15:17, Andy Furniss wrote: Carl Eugen Hoyos wrote: 2016-09-08 12:01 GMT+02:00 Andy Furniss : I don't know what it is about x11grab/CSC with ffmpeg, but on my old CPU gstreamer is twice as fast. x11grab or xcb? I guess xcb as I don't --enable anything related with configure. I

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Carl Eugen Hoyos
2016-09-08 16:17 GMT+02:00 Andy Furniss : > Carl Eugen Hoyos wrote: >> >> 2016-09-08 12:01 GMT+02:00 Andy Furniss : >> >>> I don't know what it is about x11grab/CSC with ffmpeg, but >>> on my old CPU gstreamer is twice as fast. >> >> x11grab or xcb? > > I guess xcb as I don't --enable anything rela

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Andy Furniss
Carl Eugen Hoyos wrote: 2016-09-08 12:01 GMT+02:00 Andy Furniss : I don't know what it is about x11grab/CSC with ffmpeg, but on my old CPU gstreamer is twice as fast. x11grab or xcb? I guess xcb as I don't --enable anything related with configure. _

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Carl Eugen Hoyos
2016-09-08 12:01 GMT+02:00 Andy Furniss : > I don't know what it is about x11grab/CSC with ffmpeg, but > on my old CPU gstreamer is twice as fast. x11grab or xcb? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailma

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-08 Thread Andy Furniss
Sven C. Dack wrote: It is not an issue. x11grab produces BGR0 and nvenc can handle it with the patch. It's giving me 100fp/s (up from 47fp/s) with a 1920x1080 monitor. I'd imagine people with 4K displays will be happy, too, although they will have to live with lower speeds of perhaps 30 fp/s. Wo

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Pedro Arthur
Your patch was truncated before being applied [1], someone needs to revert and apply it properly. [1] - http://ffmpeg.org/pipermail/ffmpeg-devel/2016-September/199079.html ​ ___ ffmpeg-d

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 17:52, Timo Rothenpieler wrote: applied ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel I've updated my git clone and it is now seg faulting. Sven $ ffmpeg -f x11grab -framerate 200

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Timo Rothenpieler
applied ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 15:01, Sven C. Dack wrote: On 07/09/16 14:33, Timo Rothenpieler wrote: 0RGB/0BGR does not mean the alpha bits are zeroed. It means they are undefined, so you convert from ARGB to 0RGB by doing nothing. There is no performance to gain by supporting a format that falsely advertises sup

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 14:33, Timo Rothenpieler wrote: 0RGB/0BGR does not mean the alpha bits are zeroed. It means they are undefined, so you convert from ARGB to 0RGB by doing nothing. There is no performance to gain by supporting a format that falsely advertises support for an alpha channel. Also, the co

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Timo Rothenpieler
Am 07.09.2016 um 15:26 schrieb Sven C. Dack: > On 07/09/16 12:40, Timo Rothenpieler wrote: >> libavutil/pixfmt.h defines AV_PIX_FMT_RGB0 and the other ones like this: >> >> packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined >> >> So I would expect the Alpha-Channel to be anything, and conver

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 12:40, Timo Rothenpieler wrote: libavutil/pixfmt.h defines AV_PIX_FMT_RGB0 and the other ones like this: packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined So I would expect the Alpha-Channel to be anything, and converting from RGBA to RGB0 to be a no-op "conversion". It is

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 12:27, Carl Eugen Hoyos wrote: If your patch adds "RGBA" as supported colour space, the encoder (by definition) announces that it supports transparency. nvenc does not support transparency (if it would, it would be a - grave - bug to use "RGB0" in the patch). So please do not add it.

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Timo Rothenpieler
Am 07.09.2016 um 13:27 schrieb Carl Eugen Hoyos: > 2016-09-07 12:50 GMT+02:00 Sven C. Dack : >> On 07/09/16 11:25, Carl Eugen Hoyos wrote: >>> Am 07.09.2016 um 11:40 schrieb "Sven C. Dack" : On 07/09/16 09:23, Timo Rothenpieler wrote: Otherwise will RGBA/BGRA have to be con

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Carl Eugen Hoyos
2016-09-07 12:50 GMT+02:00 Sven C. Dack : > On 07/09/16 11:25, Carl Eugen Hoyos wrote: >> >>> Am 07.09.2016 um 11:40 schrieb "Sven C. Dack" : >>> >>> On 07/09/16 09:23, Timo Rothenpieler wrote: >>> Otherwise will RGBA/BGRA have to >>> be converted into RGB0/BGR0 >>> and you will again get a perform

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 11:25, Carl Eugen Hoyos wrote: Hi! Am 07.09.2016 um 11:40 schrieb "Sven C. Dack" : On 07/09/16 09:23, Timo Rothenpieler wrote: Otherwise will RGBA/BGRA have to be converted into RGB0/BGR0 and you will again get a performance penalty. What makes you think so? I have tested it. Wh

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Carl Eugen Hoyos
Hi! > Am 07.09.2016 um 11:36 schrieb Paul B Mahol : > >> On 9/7/16, Carl Eugen Hoyos wrote: >> Hi! >> >> 2016-09-07 2:23 GMT+02:00 Sven C. Dack : On 07/09/16 01:08, Sven C. Dack wrote: > On 07/09/16 00:43, Carl Eugen Hoyos wrote: > > Should be AV_PIX_FMT_RGB0... >> >> A

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Carl Eugen Hoyos
Hi! > Am 07.09.2016 um 11:40 schrieb "Sven C. Dack" : > > On 07/09/16 09:23, Timo Rothenpieler wrote: > Otherwise will RGBA/BGRA have to > be converted into RGB0/BGR0 > and you will again get a performance penalty. What makes you think so? (The problem is that your encoder now reports "I sup

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Timo Rothenpieler
>> Also, why is the twist from AV_PIX_FMT_RGBA to NV_ENC_BUFFER_FORMAT_ABGR >> necessary? >> >> The nvenc header describes it as "8 bit Packed A8B8G8R8", so did they >> mess it up? > > It is necessary in order to make it work. The twist here is intentional > as I pointed out earlier. If you do it

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 10:40, Sven C. Dack wrote: It is necessary in order to make it work. The twist here is intentional as I pointed out earlier. If you do it the other way around as described in the documentation then you get false and missing colours. I'd like to keep in the transparency channel un

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Sven C. Dack
On 07/09/16 09:23, Timo Rothenpieler wrote: avctx->width << 1, avctx->height); +} else if (frame->format == AV_PIX_FMT_RGBA || frame->format == AV_PIX_FMT_RGB0) { + av_image_copy_plane(buf, lockBufferParams->pitch, + frame->data[0], frame->linesize[0], +

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Paul B Mahol
On 9/7/16, Carl Eugen Hoyos wrote: > Hi! > > 2016-09-07 2:23 GMT+02:00 Sven C. Dack : >> On 07/09/16 01:08, Sven C. Dack wrote: >>> >>> On 07/09/16 00:43, Carl Eugen Hoyos wrote: Should be AV_PIX_FMT_RGB0... > > As pointed out by Timo, this should be AV_PIX_FMT_0BGR32... > ... and A

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Carl Eugen Hoyos
Hi! 2016-09-07 2:23 GMT+02:00 Sven C. Dack : > On 07/09/16 01:08, Sven C. Dack wrote: >> >> On 07/09/16 00:43, Carl Eugen Hoyos wrote: >>> >>> Should be AV_PIX_FMT_RGB0... As pointed out by Timo, this should be AV_PIX_FMT_0BGR32... >>> ... and AV_PIX_FMT_BGR0 ... and this AV_PIX_FMT_0RGB32: It

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-07 Thread Timo Rothenpieler
> avctx->width << 1, avctx->height); > +} else if (frame->format == AV_PIX_FMT_RGBA || frame->format == > AV_PIX_FMT_RGB0) { > + av_image_copy_plane(buf, lockBufferParams->pitch, > + frame->data[0], frame->linesize[0], > + avctx->width << 2, avctx->height);

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-06 Thread Sven C. Dack
On 07/09/16 01:08, Sven C. Dack wrote: On 07/09/16 00:43, Carl Eugen Hoyos wrote: Should be AV_PIX_FMT_RGB0... ... and AV_PIX_FMT_BGR0 I was wondering about that. The 0 means undefined/unused and I didn't want to open a can of worms with it. Should I add BGR0 and RGB0, too? Does the 0 mean

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-06 Thread Sven C. Dack
On 07/09/16 00:43, Carl Eugen Hoyos wrote: Should be AV_PIX_FMT_RGB0... ... and AV_PIX_FMT_BGR0 I was wondering about that. The 0 means undefined/unused and I didn't want to open a can of worms with it. Should I add BGR0 and RGB0, too? Does the 0 mean it is reliably 0? Sven

Re: [FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-06 Thread Carl Eugen Hoyos
Hi! 2016-09-07 1:02 GMT+02:00 Sven C. Dack : > +case AV_PIX_FMT_RGBA: Should be AV_PIX_FMT_RGB0... > +ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_ABGR; > +break; > + > +case AV_PIX_FMT_BGRA: ... and AV_PIX_FMT_BGR0 > +ctx->surfaces[idx].format = NV_ENC_BUF

[FFmpeg-devel] adding RGBA and BGRA to nvenc.c

2016-09-06 Thread Sven C. Dack
Hello, I haven't been sending patches in ages. Can somebody walk me through? The patch is a "low hanging fruit" and simply adds the pixel formats RGBA and BGRA to the Nvidia encoder "nvenc", which supports these two formats natively. The gain here is that when one grabs the screen with x11grab