Opened 5 years ago

Last modified 5 years ago

#8067 open defect

vf_scale_vaapi fails when stream contains resolution changes

Reported by: Aman Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Given an mpegts stream which contains resolution changes, using vaapi decoding along with the scale_vaapi filter causes failures when the resolution change is encountered.

ffmpeg appears to be attempting to insert an sws scaler.

How to reproduce:

% ffmpeg -loglevel verbose -hwaccel vaapi -hwaccel_output_format vaapi -i input.ts -map 0:v -an -sn -c:v h264_vaapi -init_hw_device vaapi=intel:/dev/dri/renderD128 -profile:v 100 -level 42 -filter_hw_device intel -filter:v scale_vaapi=1280:720 -b:v 3000k -minrate 2700k -maxrate 3300k -bufsize 6000k -f null -y /dev/null
ffmpeg version 8183713 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
  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

[AVHWDeviceContext @ 0x255a000] libva: VA-API version 1.5.0
[AVHWDeviceContext @ 0x255a000] libva: va_getDriverName() returns 0
[AVHWDeviceContext @ 0x255a000] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x255a000] Initialised VAAPI connection: version 1.5
[AVHWDeviceContext @ 0x255a000] VAAPI driver: Intel i965 driver for Intel(R) Bay Trail - 2.4.0.pre1 (2.4.0.pre1).
[AVHWDeviceContext @ 0x255a000] Driver not found in known nonstandard list, using standard behaviour.
[mpegts @ 0x2569940] parser not found for codec timed_id3, packets or times may be invalid.
    Last message repeated 1 times
[h264 @ 0x256f740] Reinit context to 1280x720, pix_fmt: yuv420p
[mpegts @ 0x2569940] max_analyze_duration 5000000 reached at 5034667 microseconds st:0
Input #0, mpegts, from 'input.ts':
  Duration: 00:19:18.48, start: 0.033356, bitrate: 3445 kb/s
  Program 1
    Stream #0:0[0x101]: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 124 kb/s
    Stream #0:1[0x102]: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive, center), 1280x720, 29.97 fps, 29.97 tbr, 90k tbn, 96k tbc
    Stream #0:2[0x103]: Data: timed_id3 (ID3  / 0x20334449)
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
[mpegts @ 0x2569940] Correcting start time by 2577
[h264 @ 0x25a9100] Reinit context to 1280x720, pix_fmt: vaapi_vld
[graph 0 input from stream 0:1 @ 0x282a340] w:1280 h:720 pixfmt:vaapi_vld tb:1/90000 fr:30000/1001 sar:0/1 sws_param:flags=2
[h264_vaapi @ 0x25a6400] Input surface format is nv12.
[h264_vaapi @ 0x25a6400] Using VAAPI profile VAProfileH264High (7).
[h264_vaapi @ 0x25a6400] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[h264_vaapi @ 0x25a6400] Using VAAPI render target format YUV420 (0x1).
[h264_vaapi @ 0x25a6400] RC mode: VBR.
[h264_vaapi @ 0x25a6400] RC target: 90% of 3300000 bps over 1818 ms.
[h264_vaapi @ 0x25a6400] RC buffer: 6000000 bits, initial fullness 4500000 bits.
[h264_vaapi @ 0x25a6400] RC framerate: 30000/1001 (29.97 fps).
[h264_vaapi @ 0x25a6400] Using intra, P- and B-frames (supported references: 1 / 1).
[h264_vaapi @ 0x25a6400] All wanted packed headers available (wanted 0xd, found 0x1f).
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (h264_vaapi) (High), 1 reference frame, vaapi_vld(center), 1280x720, q=-1--1, 3000 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.54.100 h264_vaapi
[h264 @ 0x261e580] Reinit context to 1920x1088, pix_fmt: vaapi_vld
[graph 0 input from stream 0:1 @ 0x26e9d40] w:1920 h:1080 pixfmt:vaapi_vld tb:1/90000 fr:30000/1001 sar:0/1 sws_param:flags=2
[scaler_out_0_0 @ 0x27cb8c0] w:1280 h:720 flags:'bicubic' interl:0
[auto_scaler_0 @ 0x27a6200] w:iw h:ih flags:'bicubic' interl:0
[scaler_out_0_0 @ 0x27cb8c0] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_scale_vaapi_0' and the filter 'scaler_out_0_0'
Impossible to convert between the formats supported by the filter 'Parsed_scale_vaapi_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:1
[AVIOContext @ 0x25725c0] Statistics: 6606992 bytes read, 2 seeks
Conversion failed!

Change History (1)

comment:1 by Aman, 5 years ago

Status: newopen

This is being discussed on ffmpeg-devel with a patchset to add AV_CODEC_CAP_VARIABLE_DIMENSIONS flag to encoders and a -noautoscale option.

Note: See TracTickets for help on using tickets.