Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7915 closed defect (fixed)

[ffmpeg-vaapi] jpeg encode failed when build with gcc 9.1.1 on Fedora 30

Reported by: zchrzhou Owned by: Zhong,Li
Priority: normal Component: avcodec
Version: git-master Keywords: mjpeg
Cc: zhong.li@intel.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
On Fedora 30, The output of ffmpeg vaapi jpeg encode is not correct both with iHD and i965 driver, it gets green output when playback with ffplay.

The same codes (including libva,msdk,gmmlib,iHD/i965 driver and ffmpeg) work well on Fedora 29 built with gcc 8.3.1

gcc version is 9.1.1 on Fedora 30
gcc version is 8.3.1 on Fedora 29

libva 520b9e54f95d
libva-utils 7be46f017cae
intel-vaapi-driver 7b859a9b143f
gmmlib 8feb8385a3c9
intel-media-driver 37f9922543d7
msdk 98ff579a9c4f
ffmpeg 58d167bcd517

How to reproduce:

% ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -v verbose -f rawvideo -pix_fmt yuv420p -s:v 1280x720 -i /opt/media/src/assets/otc-media/yuv/stockholm_1280x720_604_1280x720_I420.yuv -vf 'format=nv12,hwupload' -c:v mjpeg_vaapi -global_quality 75 -vframes 10 -y /opt/media/src/vaapi-fits-smoke/results/smoke/6ed45286-7853-11e9-b16d-0242ac110002_0/_0.test.ffmpeg-vaapi.encode.jpeg/cqp/stockholm-cqp-baseline-75.mjpeg

% ffplay stockholm-cqp-baseline-75.mjpeg

% ffmpeg -v
ffmpeg version N-93863-g58d167bcd5 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (GCC)
  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      56. 27.100 / 56. 27.100
  libavcodec     58. 52.101 / 58. 52.101
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 53.100 /  7. 53.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Missing argument for option 'v'.
Error splitting the argument list: Invalid argument

Attachments (1)

stockholm-cqp-baseline-75.mjpeg (1.5 MB ) - added by zchrzhou 5 years ago.

Download all attachments as: .zip

Change History (10)

by zchrzhou, 5 years ago

comment:1 by U. Artie Eoff, 5 years ago

When I play the ffmpeg encoded video with gstreamer, it plays fine. However, when I play the same video with yamidecode it fails:

$ LIBYAMI_LOG_LEVEL=255 yamidecode -i vaapi.mjpeg 
libyami warning 2399 (utils.cpp, 64): can't find fourcc for /, return i420
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /home/uaeoff/Work/workspace/media/install/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
libyami info 2399 (vaapidecoder_base.cpp, 45): base: construct()
libyami info 2399 (vaapidecoder_host.cpp, 92): Created decoder for mimeType: 'image/jpeg'
libyami debug 2399 (vaapiDecoderJPEG.cpp, 400): start
libyami debug 2399 (decodeinput.cpp, 344): m_lastReadOffset=0x0, m_availableData=0x17f312
libyami debug 2399 (decodeinput.cpp, 359): offset=71774, NALU data=0x7fc13596a010, size=71776
libyami debug 2399 (jpegParser.cpp, 372): parse (byte:0xd8 position:1)
libyami debug 2399 (jpegParser.cpp, 372): parse (byte:0xdb position:3)
libyami debug 2399 (jpegParser.cpp, 372): parse (byte:0xc0 position:137)
libyami debug 2399 (jpegParser.cpp, 515): baseline      : 1
libyami debug 2399 (jpegParser.cpp, 516): progressive   : 0
libyami debug 2399 (jpegParser.cpp, 517): arithmetic    : 0
libyami debug 2399 (jpegParser.cpp, 518): precision     : 8
libyami debug 2399 (jpegParser.cpp, 519): image width   : 1280
libyami debug 2399 (jpegParser.cpp, 520): image height  : 720
libyami debug 2399 (jpegParser.cpp, 521): num components: 3
libyami debug 2399 (vaapiDecoderJPEG.cpp, 400): start
libyami debug 2399 (jpegParser.cpp, 372): parse (byte:0xc4 position:156)
libyami debug 2399 (jpegParser.cpp, 372): parse (byte:0xda position:576)
libyami error 2399 (jpegParser.cpp, 610): Bad Component Id (0)
got fatal error -1022
libyami info 2399 (vaapidecoder_base.cpp, 55): base: deconstruct()
libyami info 2399 (vaapidecoder_base.cpp, 155): base: stop()
libyami info 2399 (vaapidecoder_base.cpp, 358): base: terminate VA
libyami debug 2399 (vaapidecoder_base.cpp, 363): surface pool is reset
VppInputDecode config failed.
DecodeTest init failed.

If I compile ffmpeg with --disable-optimizations, then this problem goes away completely.

comment:2 by U. Artie Eoff, 5 years ago

After inspecting the jpeg file, it looks like all three component id's in the frame header (SOF) equal 0. This is wrong. Each component id should be unique. When compile time optimizations are disabled, the component ids are 1, 2 and 3, respectively.

comment:3 by U. Artie Eoff, 5 years ago

Last edited 5 years ago by U. Artie Eoff (previous) (diff)

comment:4 by U. Artie Eoff, 5 years ago

Owner: set to U. Artie Eoff
Status: newopen

comment:5 by U. Artie Eoff, 5 years ago

Owner: changed from U. Artie Eoff to Zhong,Li

comment:6 by U. Artie Eoff, 5 years ago

@lizhong1008 can you have a review/merge the patch please?

comment:7 by U. Artie Eoff, 5 years ago

Component: undeterminedavcodec

comment:8 by U. Artie Eoff, 5 years ago

Resolution: fixed
Status: openclosed
Last edited 5 years ago by Carl Eugen Hoyos (previous) (diff)

comment:9 by Carl Eugen Hoyos, 5 years ago

Keywords: mjpeg added; vaapi encode jpeg removed
Note: See TracTickets for help on using tickets.