AMD screen record + h/w vaapi encode to mkv fails.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

AMD screen record + h/w vaapi encode to mkv fails.

Andy Furniss-2
Haven't had time to bisect, but I can't screengrab to mkv any more.
kmsgrab + playing with vsync etc. give the same error as this example,
mp4 works OK.

  ffm -loglevel debug -vaapi_device /dev/dri/renderD128 -f x11grab
-video_size 1920x1080 -i :0 -vf 'format=nv12,hwupload' -c:v h264_vaapi
-profile:v 578 -bf 0 -y out.mkv
ffmpeg version N-90148-g0419623cdc Copyright (c) 2000-2018 the FFmpeg
developers
   built with gcc 7.3.0 (GCC)
   configuration: --prefix=/usr --disable-doc --enable-gpl
--enable-libvpx --enable-libx265 --enable-libx264 --enable-gnutls
--enable-libdrm --enable-libfreetype --enable-libmp3lame
   libavutil      56.  7.101 / 56.  7.101
   libavcodec     58. 12.102 / 58. 12.102
   libavformat    58.  9.100 / 58.  9.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.101 /  5.  0.101
   libswresample   3.  0.101 /  3.  0.101
   libpostproc    55.  0.100 / 55.  0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set
VAAPI hardware device (DRM path or X11 display name)) with argument
'/dev/dri/renderD128'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'x11grab'.
Reading option '-video_size' ... matched as AVOption 'video_size' with
argument '1920x1080'.
Reading option '-i' ... matched as input url with argument ':0'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with
argument 'format=nv12,hwupload'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'h264_vaapi'.
Reading option '-profile:v' ... matched as option 'profile' (set
profile) with argument '578'.
Reading option '-bf' ... matched as AVOption 'bf' with argument '0'.
Reading option '-y' ... matched as option 'y' (overwrite output files)
with argument '1'.
Reading option 'out.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11
display name)) with argument /dev/dri/renderD128.
[AVHWDeviceContext @ 0x2152640] Opened VA display via DRM device
/dev/dri/renderD128.
[AVHWDeviceContext @ 0x2152640] libva: VA-API version 1.1.0
[AVHWDeviceContext @ 0x2152640] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x2152640] libva: User requested driver 'radeonsi'
[AVHWDeviceContext @ 0x2152640] libva: Trying to open
/usr/lib/dri/radeonsi_drv_video.so
[AVHWDeviceContext @ 0x2152640] libva: Found init function
__vaDriverInit_1_1
[AVHWDeviceContext @ 0x2152640] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x2152640] Initialised VAAPI connection: version 1.1
[AVHWDeviceContext @ 0x2152640] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x2152640] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x2152640] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x2152640] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x2152640] Format 0x56595559 -> unknown.
[AVHWDeviceContext @ 0x2152640] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x2152640] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x2152640] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x2152640] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x2152640] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x2152640] Unknown driver "Mesa Gallium driver
18.1.0-devel for AMD Radeon R9 200 Series (TONGA / DRM 3.25.0 /
4.16.0-rc1-g2693c7e7ca44, LLVM 7.0.0)", assuming standard behaviour.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url :0.
Applying option f (force format) with argument x11grab.
Successfully parsed a group of options.
Opening an input file: :0.
[x11grab @ 0x223ca00] Probe buffer size limit of 5000000 bytes reached
[x11grab @ 0x223ca00] Stream #0: not enough frames to estimate rate;
consider increasing probesize
Input #0, x11grab, from ':0':
   Duration: N/A, start: 1519432751.575405, bitrate: N/A
     Stream #0:0, 1, 1/1000000: Video: rawvideo, 1 reference frame
(BGR[0] / 0x524742), bgr0, 1920x1080, 0/1, 29.97 fps, 1000k tbr, 1000k
tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output url out.mkv.
Applying option vf (set video filters) with argument format=nv12,hwupload.
Applying option c:v (codec name) with argument h264_vaapi.
Applying option profile:v (set profile) with argument 578.
Successfully parsed a group of options.
Opening an output file: out.mkv.
[file @ 0x224ab40] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[rawvideo @ 0x22467c0] PACKET SIZE: 8294400, STRIDE: 7680
detected 4 logical cores
[Parsed_format_0 @ 0x224cc00] Setting 'pix_fmts' to value 'nv12'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'video_size' to
value '1920x1080'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'pix_fmt' to value '123'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'time_base' to value
'1/1000000'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x224dbc0] Setting 'frame_rate' to
value '30000/1001'
[graph 0 input from stream 0:0 @ 0x224dbc0] w:1920 h:1080 pixfmt:bgr0
tb:1/1000000 fr:30000/1001 sar:0/1 sws_param:flags=2
[format @ 0x21521c0] Setting 'pix_fmts' to value 'vaapi_vld'
[auto_scaler_0 @ 0x224f000] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x224f000] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x224cc00] auto-inserting filter 'auto_scaler_0'
between the filter 'graph 0 input from stream 0:0' and the filter
'Parsed_format_0'
[AVFilterGraph @ 0x224bf80] query_formats: 5 queried, 3 merged, 1
already done, 0 delayed
[auto_scaler_0 @ 0x224f000] w:1920 h:1080 fmt:bgr0 sar:0/1 -> w:1920
h:1080 fmt:nv12 sar:0/1 flags:0x4
[hwupload @ 0x224a2c0] Surface format is nv12.
[AVHWFramesContext @ 0x224a0c0] Created surface 0x1.
[AVHWFramesContext @ 0x224a0c0] Direct mapping disabled: deriving image
does not work: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0x224a0c0] Map surface 0x1.
[AVHWFramesContext @ 0x224a0c0] Unmap surface 0x1.
[h264_vaapi @ 0x2248bc0] Warning: some packed headers are not supported
(want 0xd, got 0).
[h264_vaapi @ 0x2248bc0] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x22edf80] Created surface 0x3.
[AVHWFramesContext @ 0x22edf80] Direct mapping disabled: deriving image
does not work: 6 (invalid VASurfaceID).
[AVHWFramesContext @ 0x22edf80] Created surface 0x4.
[AVHWFramesContext @ 0x22edf80] Created surface 0x5.
[h264_vaapi @ 0x2248bc0] Using fixed QP = 20 / 20 / 24 for IDR- / P- /
B-frames.
[matroska @ 0x2246d80] get_metadata_duration returned: 0
Could not write header for output file #0 (incorrect codec parameters
?): Invalid data found when processing input
Error initializing output stream 0:0 --
[AVIOContext @ 0x2249b80] Statistics: 0 seeks, 1 writeouts
Conversion failed



_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: AMD screen record + h/w vaapi encode to mkv fails.

Andy Furniss-2
Andy Furniss wrote:
> Haven't had time to bisect, but I can't screengrab to mkv any more.
> kmsgrab + playing with vsync etc. give the same error as this example,
> mp4 works OK.

Bisected to -

commit ae7df68edd79bce5c318810c6b307ee4e81cd2a6
Author: James Almer <[hidden email]>
Date:   Fri Nov 24 19:42:50 2017 -0300

     avformat/avc: return an error in ff_isom_write_avcc if the buffer
lenght is too small

     Signed-off-by: James Almer <[hidden email]>

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: AMD screen record + h/w vaapi encode to mkv fails.

Andy Furniss-2
Andy Furniss wrote:

> Andy Furniss wrote:
>> Haven't had time to bisect, but I can't screengrab to mkv any more.
>> kmsgrab + playing with vsync etc. give the same error as this example,
>> mp4 works OK.
>
> Bisected to -
>
> commit ae7df68edd79bce5c318810c6b307ee4e81cd2a6
> Author: James Almer <[hidden email]>
> Date:   Fri Nov 24 19:42:50 2017 -0300
>
>      avformat/avc: return an error in ff_isom_write_avcc if the buffer
> lenght is too small
>
>      Signed-off-by: James Almer <[hidden email]>

I thought this was just screen rec initially, but it can be reproduced
with a transcode as well. Replacing mkv with mp4 in the examples will
work OK.

Adding Mark to cc.

ffm -vaapi_device /dev/dri/renderD128 -i ~/abc-60fps.mp4 -an -sn -vf
'format=nv12,hwupload' -c:v h264_vaapi -profile:v 578 -bf 0 -y ~/out.mkv
ffmpeg version N-90242-g5ab0ecf283 Copyright (c) 2000-2018 the FFmpeg
developers
   built with gcc 7.3.0 (GCC)
   configuration: --prefix=/usr --disable-doc --enable-gpl
--enable-libvpx --enable-libx265 --enable-libx264 --enable-gnutls
--enable-libdrm --enable-libfreetype --enable-libmp3lame
   libavutil      56.  8.100 / 56.  8.100
   libavcodec     58. 13.102 / 58. 13.102
   libavformat    58. 10.100 / 58. 10.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.102 /  5.  0.102
   libswresample   3.  0.101 /  3.  0.101
   libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/andy/abc-60fps.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf58.0.100
   Duration: 00:01:36.00, start: 0.000000, bitrate: 624 kb/s
     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080, 619 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
     Metadata:
       handler_name    : VideoHandler
Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
[h264_vaapi @ 0x4062880] Warning: some packed headers are not supported
(want 0xd, got 0).
Could not write header for output file #0 (incorrect codec parameters
?): Invalid data found when processing input
Error initializing output stream 0:0 --
Conversion failed!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".