avfvideosrc: incorrect retina support
I have UHD monitor with resolution: 3840x2160. When I change resolution to "Scaled" inside System Settings to 3360x1890 I have the next pipeline:
MacBookPro:~ roman$ gst-launch-1.0 avfvideosrc capture-screen=true ! glimagesink sync=false -vv
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayCocoa\)\ gldisplaycocoa0";
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0.GstPad:src: caps = video/x-raw, width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw, width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLUploadElement:gluploadelement0.GstPad:src: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLColorConvertElement:glcolorconvertelement0.GstPad:src: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)RGBA, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLColorBalance:glcolorbalance0.GstPad:src: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)RGBA, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink.GstPad:sink: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)RGBA, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLColorBalance:glcolorbalance0.GstPad:sink: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)RGBA, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLColorConvertElement:glcolorconvertelement0.GstPad:sink: caps = video/x-raw(memory:GLMemory), width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1, texture-target=(string)2D
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLUploadElement:gluploadelement0.GstPad:sink: caps = video/x-raw, width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0.GstGhostPad:sink: caps = video/x-raw, width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1
/GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLUploadElement:gluploadelement0.GstPad:sink: caps = video/x-raw, width=(int)6720, height=(int)3780, format=(string)UYVY, framerate=(fraction)2147483647/1
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:09.593902000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
In system info I see:
Resolution: 6720 x 3780
Interface Type: 3360 x 1890 @ 60 Hz
This is incorrect behaviour, because when I try to capture and encode this stream I have the next error:
MacBookPro:~ roman$ gst-launch-1.0 avfvideosrc capture-screen=true ! vtenc_h264_hw ! fakesink -vv
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0.GstPad:src: caps = video/x-raw, width=(int)6720, height=(int)3780, framerate=(fraction)2147483647/1, format=(string)UYVY
0:00:00.616859000 79505 0x7fec1e818ed0 ERROR vtenc vtenc.c:861:gst_vtenc_create_session:<vtenc_h264_hw0> VTCompressionSessionCreate() returned: -12915
0:00:00.710160000 79505 0x7fec1e818ed0 ERROR vtenc vtenc.c:861:gst_vtenc_create_session:<vtenc_h264_hw0> VTCompressionSessionCreate() returned: -12915
0:00:00.790690000 79505 0x7fec1e818ed0 ERROR vtenc vtenc.c:861:gst_vtenc_create_session:<vtenc_h264_hw0> VTCompressionSessionCreate() returned: -12915
0:00:00.861438000 79505 0x7fec1e818ed0 ERROR vtenc vtenc.c:861:gst_vtenc_create_session:<vtenc_h264_hw0> VTCompressionSessionCreate() returned: -12915
ERROR: from element /GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3064): gst_base_src_loop (): /GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.817796000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
0:00:00.938246000 79505 0x7fec1e818ed0 ERROR vtenc vtenc.c:861:gst_vtenc_create_session:<vtenc_h264_hw0> VTCompressionSessionCreate() returned: -12915
Setting pipeline to NULL ...
Freeing pipeline ...
The real resolution is can not be more than 3840x2160. When I set "default resolution for this monitor" in System Settings I have:
MacBookPro:~ roman$ gst-launch-1.0 avfvideosrc capture-screen=true ! vtenc_h264_hw ! fakesink -vv
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0.GstPad:src: caps = video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, format=(string)UYVY
/GstPipeline:pipeline0/vtenc_h264_hw:vtenc_h264_hw0.GstPad:sink: caps = video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, format=(string)UYVY
/GstPipeline:pipeline0/vtenc_h264_hw:vtenc_h264_hw0.GstPad:src: caps = video/x-h264, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d003cffe10019274d003c898b601e0021f6024c6606000bb80002ee0bdef82801000428ee1f20, level=(string)6, profile=(string)main, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h264, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d003cffe10019274d003c898b601e0021f6024c6606000bb80002ee0bdef82801000428ee1f20, level=(string)6, profile=(string)main, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
Redistribute latency...
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:02.537316000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
and
Resolution: 3840 x 2160 (2160p 4K UHD — Ultra High Definition)
Interface Type: 1920 x 1080 @ 60 Hz
When I set to maximum UHD resolution I have:
MacBookPro:~ roman$ gst-launch-1.0 avfvideosrc capture-screen=true ! vtenc_h264_hw ! fakesink -vv
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstAVFVideoSrc:avfvideosrc0.GstPad:src: caps = video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, format=(string)UYVY
/GstPipeline:pipeline0/vtenc_h264_hw:vtenc_h264_hw0.GstPad:sink: caps = video/x-raw, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, format=(string)UYVY
/GstPipeline:pipeline0/vtenc_h264_hw:vtenc_h264_hw0.GstPad:src: caps = video/x-h264, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d003cffe10019274d003c898b601e0021f6024c6606000bb80002ee0bdef82801000428ee1f20, level=(string)6, profile=(string)main, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h264, width=(int)3840, height=(int)2160, framerate=(fraction)2147483647/1, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d003cffe10019274d003c898b601e0021f6024c6606000bb80002ee0bdef82801000428ee1f20, level=(string)6, profile=(string)main, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
Redistribute latency...
Redistribute latency...
and
Resolution: 3840 x 2160 (2160p 4K UHD — Ultra High Definition)
Interface Type: 3840 x 2160 @ 60 Hz
I think the problem inside of scale factor for intermediates resolutions. May be this Apple problem...