[FFmpeg-trac] #9389(avcodec:new): [regression] Film Grain breaks h264_vaapi

FFmpeg trac at avcodec.org
Wed Aug 25 20:34:02 EEST 2021


#9389: [regression] Film Grain breaks h264_vaapi
-------------------------------------+-------------------------------------
             Reporter:  U. Artie     |                     Type:  defect
  Eoff                               |
               Status:  new          |                 Priority:  critical
            Component:  avcodec      |                  Version:
             Keywords:  regression,  |  unspecified
  vaapi                              |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 Transcoding h264 to h264 with vaapi plugins causes pipeline failure since
 the introduction of '''Film Grain''' patches.  Occasionally the pipeline
 will succeed, but the output is corrupted.  Sometimes the pipeline crashes
 with {{{ffmpeg: i965_encoder.c:134: intel_encoder_check_yuv_surface:
 Assertion `obj_surface && obj_surface->bo' failed.}}} error.

 If I add {{{-export_side_data film_grain}}} to the command-line, then the
 issue disappears.

 The bad commit window is:

 {{{
 ab25874e3245 - avcodec/h264_slice: signal the presence of Film Grain in
 the decoder context
 61b38f7aef8d - avfilter/avfilter: add a return at the end of a non-void
 function
 7f194c7d965f - avfilter/af_afreqshift: allow to change order of filters
 ff02a4239412 - avformat/crcenc: Simplify writing trailer
 88b3e3156231 - avformat/matroskaenc: Only compile functions when needed
 201b8a4d67f7 - avformat/matroskadec: Include webm_dash_manifest demuxer
 only if enabled
 750631b0989b - avformat/matroskaenc: Pass dispositions through unchanged
 by default
 beb60abab5b1 - avformat/matroskaenc: Allow to set multiple streams as
 default
 66845cffc3bb - avcodec/h264dec: apply H.274 film grain
 6bc29a6b571c - avcodec/h274: add film grain synthesis routine
 cf37c3fb6c84 - avcodec/h264_slice: compute and export film grain seed
 9b05263ac166 - avcodec/av1: signal the presence of Film Grain in the
 decoder context
 651fed386032 - avcodec/libdav1d: signal the presence of Film Grain in the
 decoder context
 590a7e02f047 - avcodec: add a Film Grain codec property flag
 6dd7149f4c35 - avcodec/pthread_frame: also keep AVCodecContext.properties
 in sync between threads
 }}}

 How to reproduce:
 {{{
 % ffmpeg -v verbose -init_hw_device vaapi=hw:/dev/dri/renderD128 \
   -filter_hw_device hw -hwaccel_output_format vaapi -hwaccel vaapi \
   -c:v h264 -i vintage_car_1920x1080_24p_4_0_1920x1080p_71frames.264 \
   -an -vsync passthrough -c:v h264_vaapi -vframes 71 \
   -y H_H-AVC-vintage_car_0_0.h264 \
   -vf 'hwdownload,format=nv12' -pix_fmt yuv420p -f rawvideo \
   -vframes 71 \
   -y src_H_H-AVC-vintage_car.yuv

  ffmpeg version N-103376-gfbbca7b8fa Copyright (c) 2000-2021 the FFmpeg
 developers
    built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
    configuration: --prefix=/opt/media/install --disable-static --enable-
 shared --enable-libdrm --enable-vaapi --enable-libmfx --disable-amf
 --disable-audiotoolbox --disable-cuda --disable-cuda-sdk --disable-cuvid
 --disable-d3d11va --disable-dxva2 --disable-libnpp --disable-mmal
 --disable-nvdec --disable-nvenc --disable-omx --disable-omx-rpi --disable-
 rkmpp --disable-v4l2-m2m --disable-vdpau --disable-videotoolbox --enable-
 gpl --enable-libx264 --enable-libx265
    libavutil      57.  4.101 / 57.  4.101
    libavcodec     59.  6.100 / 59.  6.100
    libavformat    59.  4.102 / 59.  4.102
    libavdevice    59.  0.101 / 59.  0.101
    libavfilter     8.  3.100 /  8.  3.100
    libswscale      6.  0.100 /  6.  0.100
    libswresample   4.  0.100 /  4.  0.100
    libpostproc    56.  0.100 / 56.  0.100
  [AVHWDeviceContext @ 0x5563d4281240] libva: VA-API version 1.13.0
  [AVHWDeviceContext @ 0x5563d4281240] libva: User environment variable
 requested driver 'iHD'
  [AVHWDeviceContext @ 0x5563d4281240] libva: Trying to open
 /opt/media/install/lib/dri/iHD_drv_video.so
  [AVHWDeviceContext @ 0x5563d4281240] libva: Found init function
 __vaDriverInit_1_13
  [AVHWDeviceContext @ 0x5563d4281240] libva: va_openDriver() returns 0
  [AVHWDeviceContext @ 0x5563d4281240] Initialised VAAPI connection:
 version 1.13
  [AVHWDeviceContext @ 0x5563d4281240] VAAPI driver: Intel iHD driver for
 Intel(R) Gen Graphics - 21.3.2 ().
  [AVHWDeviceContext @ 0x5563d4281240] Driver not found in known
 nonstandard list, using standard behaviour.
  [h264 @ 0x5563d42c24c0] Reinit context to 1920x1088, pix_fmt: yuv420p
  [h264 @ 0x5563d42c24c0] Increasing reorder buffer to 1
  Input #0, h264, from '/opt/media/src/assets/otc-
 media/bat/avc/vintage_car_1920x1080_24p_4_0_1920x1080p_71frames.264':
    Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), 1 reference frame,
 yuv420p(progressive), 1920x1080 (1920x1088), Film Grain, 25 fps, 25 tbr,
 1200k tbn
  Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
    Stream #0:0 -> #1:0 (h264 (native) -> rawvideo (native))
  Press [q] to stop, [?] for help
  [h264 @ 0x5563d42e03c0] Reinit context to 1920x1088, pix_fmt: vaapi
  [graph 0 input from stream 0:0 @ 0x5563d42e5400] w:1920 h:1080
 pixfmt:vaapi tb:1/1200000 fr:25/1 sar:0/1
  [h264_vaapi @ 0x5563d42de640] Using input frames context (format vaapi)
 with h264_vaapi encoder.
  [h264_vaapi @ 0x5563d42de640] Input surface format is nv12.
  [h264_vaapi @ 0x5563d42de640] Using VAAPI profile VAProfileH264High (7).
  [h264_vaapi @ 0x5563d42de640] Using VAAPI entrypoint VAEntrypointEncSlice
 (6).
  [h264_vaapi @ 0x5563d42de640] Using VAAPI render target format YUV420
 (0x1).
  [h264_vaapi @ 0x5563d42de640] No quality level set; using default (20).
  [h264_vaapi @ 0x5563d42de640] RC mode: ICQ.
  [h264_vaapi @ 0x5563d42de640] RC quality: 20.
  [h264_vaapi @ 0x5563d42de640] RC framerate: 25/1 (25.00 fps).
  [h264_vaapi @ 0x5563d42de640] Using intra, P- and B-frames (supported
 references: 8 / 2).
  [h264_vaapi @ 0x5563d42de640] All wanted packed headers available (wanted
 0xd, found 0x1f).
  [h264_vaapi @ 0x5563d42de640] Using level 4.
  Output #0, h264, to '/opt/media/test-results/vaapi-fits/366b557e-04fc-
 11ec-9bb8-0242ac120002_0/_0.test.ffmpeg-vaapi.transcode.avc/default/H_H-
 AVC-vintage_car_0_0.h264':
    Metadata:
      encoder         : Lavf59.4.102
    Stream #0:0: Video: h264 (High), 1 reference frame, vaapi(progressive),
 1920x1080 (0x0), q=2-31, 25 fps, 25 tbn
      Metadata:
        encoder         : Lavc59.6.100 h264_vaapi
  [graph 1 input from stream 0:0 @ 0x5563d5ee1580] w:1920 h:1080
 pixfmt:vaapi tb:1/1200000 fr:25/1 sar:0/1
  [auto_scale_0 @ 0x5563d5ee4080] w:iw h:ih flags:'' interl:0
  [format @ 0x5563d5ee26c0] auto-inserting filter 'auto_scale_0' between
 the filter 'Parsed_format_1' and the filter 'format'
  [auto_scale_0 @ 0x5563d5ee4080] w:1920 h:1080 fmt:nv12 sar:0/1 -> w:1920
 h:1080 fmt:yuv420p sar:0/1 flags:0x0
  Output #1, rawvideo, to '/opt/media/test-results/vaapi-fits/366b557e-
 04fc-11ec-9bb8-0242ac120002_0/_0.test.ffmpeg-vaapi.transcode.avc/default
 /src_H_H-AVC-vintage_car.yuv':
    Metadata:
      encoder         : Lavf59.4.102
    Stream #1:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449),
 yuv420p(tv, progressive), 1920x1080 (0x0), q=2-31, 622080 kb/s, 25 fps, 25
 tbn
      Metadata:
        encoder         : Lavc59.6.100 rawvideo
  frame=    1 fps=0.0 q=0.0 q=-0.0 size=       0kB time=00:00:00.04
 bitrate=   0.0kbits/s speed=2.45x
  [h264 @ 0x5563d4404d80] get_buffer() failed
  [h264 @ 0x5563d4404d80] thread_get_buffer() failed
  [h264 @ 0x5563d4404d80] decode_slice_header error
  [h264 @ 0x5563d4404d80] no frame!
  Error while decoding stream #0:0: Invalid data found when processing
 input
  [h264 @ 0x5563d4404d80] get_buffer() failed
  [h264 @ 0x5563d4404d80] thread_get_buffer() failed
  [h264 @ 0x5563d4404d80] decode_slice_header error
  [h264 @ 0x5563d4404d80] no frame!
  Error while decoding stream #0:0: Invalid data found when processing
 input
  [h264 @ 0x5563d44f47c0] get_buffer() failed
  [h264 @ 0x5563d44f47c0] thread_get_buffer() failed
  [h264 @ 0x5563d44f47c0] decode_slice_header error
  [h264 @ 0x5563d44f47c0] no frame!
  Error while decoding stream #0:0: Invalid data found when processing
 input
  [h264 @ 0x5563d44f47c0] get_buffer() failed
  [h264 @ 0x5563d44f47c0] thread_get_buffer() failed
  [h264 @ 0x5563d44f47c0] decode_slice_header error
  [h264 @ 0x5563d44f47c0] no frame!
  Error while decoding stream #0:0: Invalid data found when processing
 input
  frame=   56 fps=0.0 q=-0.0 q=-0.0 size=    2816kB time=00:00:02.36
 bitrate=9774.9kbits/s speed=4.56x
  No more output streams to write to, finishing.
  frame=   67 fps=0.0 q=-0.0 Lq=-0.0 size=    3991kB time=00:00:02.84
 bitrate=11510.8kbits/s speed=4.58x
  video:207503kB audio:0kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: unknown
  Input file #0 (/opt/media/src/assets/otc-
 media/bat/avc/vintage_car_1920x1080_24p_4_0_1920x1080p_71frames.264):
    Input stream #0:0 (video): 71 packets read (2642103 bytes); 67 frames
 decoded;
    Total: 71 packets (2642103 bytes) demuxed
  Output file #0 (/opt/media/test-results/vaapi-fits/366b557e-04fc-11ec-
 9bb8-0242ac120002_0/_0.test.ffmpeg-vaapi.transcode.avc/default/H_H-AVC-
 vintage_car_0_0.h264):
    Output stream #0:0 (video): 67 frames encoded; 67 packets muxed
 (4086331 bytes);
    Total: 67 packets (4086331 bytes) muxed
  Output file #1 (/opt/media/test-results/vaapi-fits/366b557e-04fc-11ec-
 9bb8-0242ac120002_0/_0.test.ffmpeg-vaapi.transcode.avc/default/src_H_H-
 AVC-vintage_car.yuv):
    Output stream #1:0 (video): 67 frames encoded; 67 packets muxed
 (208396800 bytes);
    Total: 67 packets (208396800 bytes) muxed
  [AVIOContext @ 0x5563d44a5e00] Statistics: 0 seeks, 16 writeouts
  [AVIOContext @ 0x5563d43ef340] Statistics: 0 seeks, 795 writeouts
  [AVIOContext @ 0x5563d42c9cc0] Statistics: 2642103 bytes read, 0 seeks

 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9389>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list