After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765693 - vaapiencode: fail to link with vaapidecode with certain media
vaapiencode: fail to link with vaapidecode with certain media
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
1.8.1
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-27 19:03 UTC by kprugh
Modified: 2017-08-09 09:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GST_DEBUG=5 pipeline log (459.43 KB, application/x-bzip)
2016-04-27 19:03 UTC, kprugh
Details
Forcing video/x-raw log (92.69 KB, text/plain)
2016-04-27 20:51 UTC, kprugh
Details

Description kprugh 2016-04-27 19:03:19 UTC
Created attachment 326888 [details]
GST_DEBUG=5 pipeline log

Hello, I have an h264 ts file that is being streamed over the network and received by a GStreamer Pipeline but fails to run. 

The pipeline: gst-launch-1.0 -v udpsrc port=5000 ! tsdemux ! h264parse ! vaapidecode ! vaapih264enc ! fakesink

(also fails with vaapidecode -> vaapipostproc -> vaapih264enc)

Replacing vaapidecode with avdec_h264 allows the pipeline to run. The only thing that I've spotted is avdec_h264 outputs 30000/1001 for the framerate while vaapidecode outputs 0/1. 

(Happens on both GStreamer 1.6.3 [gstreamer-vaapi tag 1.6.0] and 1.8.1 [gstreamer-vaapi tag 1.8.1])

libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.0)
vainfo: Driver version: Intel i965 driver for Intel(R) CherryView - 1.7.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD

Here's a mediainfo dump of the file:
General
ID/String                        : 1 (0x1)
CompleteName                     : foo.ts
Format                           : MPEG-TS
FileSize/String                  : 5.72 GiB
Duration/String                  : 3h 21mn
OverallBitRate_Mode/String       : Constant
OverallBitRate/String            : 4 061 Kbps

Video
ID/String                        : 481 (0x1E1)
MenuID/String                    : 1 (0x1)
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format_Profile                   : Main@L3.1
Format_Settings_CABAC/String     : Yes
Format_Settings_RefFrames/String : 2 frames
Format_Settings_GOP              : M=3, N=90
CodecID                          : 27
Duration/String                  : 3h 21mn
BitRate_Mode/String              : Constant
BitRate_Nominal/String           : 3 400 Kbps
Width/String                     : 1 280 pixels
Height/String                    : 720 pixels
DisplayAspectRatio/String        : 16:9
FrameRate/String                 : 29.970 fps
ColorSpace                       : YUV
ChromaSubsampling                : 4:2:0
BitDepth/String                  : 8 bits
ScanType/String                  : Progressive
Bits-(Pixel*Frame)               : 0.123

Audio
ID/String                        : 482 (0x1E2)
MenuID/String                    : 1 (0x1)
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format_Version                   : Version 4
Format_Profile                   : LC
MuxingMode                       : ADTS
CodecID                          : 15
Duration/String                  : 3h 21mn
BitRate_Mode/String              : Variable
Channel(s)/String                : 2 channels
ChannelPositions                 : Front: L R
SamplingRate/String              : 48.0 KHz
Compression_Mode/String          : Lossy
Video_Delay/String               : -21ms
Comment 1 Víctor Manuel Jáquez Leal 2016-04-27 20:06:05 UTC
What happens if you set a capsfilter between the the decoder and the encoder, forcing raw filters??

... vaapidecode ! video/x-raw, format=NV12 ! vaapih264enc ...

Glancing the logs it looks like if the encoder doesn't accept the memory:VASurface feature...
Comment 2 kprugh 2016-04-27 20:51:42 UTC
Created attachment 326894 [details]
Forcing video/x-raw log

Forcing video/x-raw didn't seem to change much.

I've attached the log of the pipeline: DISPLAY=:0 GST_DEBUG=4 gst-launch-1.0 -v udpsrc port=5000 ! tsdemux ! h264parse ! vaapidecode ! video/x-raw, format=NV12 ! vaapih264enc ! fakesink


From what I see it also ignored the format=NV12 part?
Comment 3 kprugh 2016-04-27 21:09:12 UTC
Additionally it seems that all the H.264 TS files I have on hand cause the pipeline to fail. So it may be just H264 with vaapidecode in general? Both 1080p and 720p at least. 

All my mpeg2 TS files work flawlessly.
Comment 4 Víctor Manuel Jáquez Leal 2016-04-28 11:10:45 UTC
I can reproduce the error with

gst-launch-1.0 filesrc location=~/patterns/MainconceptLogo_Blu-ray_AVC_1920x1080_LPCM.mpg ! tsdemux ! h264parse ! vaapidecode ! vaapih264enc ! fakesink -v

The sample file comes from: http://www.mainconcept.com/eu/products/for-developers/sample-footage.html though, it is interleaved.

The problem, as far as I debugged is that set_format() is never called, so the get_caps() ends failing.
Comment 5 Víctor Manuel Jáquez Leal 2016-04-28 14:54:01 UTC
With the sample file, which is interlaced (not interleaved, sorry), using vaapipostproc, the pipeline works.

gst-launch-1.0 filesrc location=~/patterns/MainconceptLogo_Blu-ray_AVC_1920x1080_LPCM.mpg ! tsdemux ! h264parse ! vaapidecode ! vaapipostproc ! vaapih264enc ! fakesink -v 

As far as I understand, the caps that vaapidecode wants to push[1] are rejected by vaapih264enc, but the reason it's not clear to me right now.

An experiment is to add some software filters like videoconvert or videoscale to force a buffer download and upload with "sanitized" caps.

1 .GST_CAPS gstpad.c:5447:pre_eventfunc_check:<vaapiencodeh264-0:sink>[00m caps video/x-raw(memory:VASurface), format=(string)I420, width=(int)1280, height=(int)720, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)0/1 not accepted
Comment 6 Víctor Manuel Jáquez Leal 2016-06-09 11:00:18 UTC
(In reply to kprugh from comment #3)
> Additionally it seems that all the H.264 TS files I have on hand cause the
> pipeline to fail. So it may be just H264 with vaapidecode in general? Both
> 1080p and 720p at least. 

I have been testing with different sample files but I cannot reproduce the failure. Could you share your file?
Comment 7 Paulo Neves 2016-09-02 16:04:50 UTC
I have the exact same problem with the video coming from a C920 camera. Do you want me to capture the video in some specific format?
Comment 8 Paulo Neves 2016-09-02 16:17:45 UTC
Sorry to spam in so short time but I think the culprit is vaapidecode because the following pipeline also fails:

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-h264,width=1920,height=1080 ! vaapidecode ! video/x-raw, format=NV12 ! fakesink

If no caps are imposed, it works correctly.
Comment 9 Víctor Manuel Jáquez Leal 2017-08-09 09:02:59 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.

Furthermore, I suspect this issue is already solved in recent releases of gstreamer-vaapi. Besides, it is always recommended to put h264parse before vaapih264enc.

Thanks!