failed to encode frame
Hi guys,
I'm trying to use vaapih264
encoder in a 'decoupled' pipeline using the inter
plugin (intervideo
elements). But I'm getting the following errors:
0:00:00.026589807 447450 0x26f7d50 WARN vaapi gstvaapiutils.c:78:gst_vaapi_warning: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
0:00:00.027412107 447450 0x26f7d50 WARN vaapiblend gstvaapiblend.c:184:gst_vaapi_blend_initialize:<vaapiblend0> VPP does not support global alpha blending
0:00:00.078968704 447450 0x26f7d50 WARN vaapi gstvaapiutils.c:78:gst_vaapi_warning: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
0:00:00.085043362 447450 0x26f7d50 WARN basesrc gstbasesrc.c:3688:gst_base_src_start_complete:<fsrc> pad not activated yet
0:00:00.086444722 447450 0x26f7d50 WARN vaapi gstvaapiutils.c:78:gst_vaapi_warning: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
0:00:00.087171222 447450 0x269d980 FIXME default gstutils.c:4025:gst_pad_create_stream_id_internal:<ivs:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.109318408 447450 0x2965860 WARN vaapifilter gstvaapifilter.c:2405:gst_vaapi_filter_set_colorimetry_unlocked:<vaapifilter1> driver does not report the supported input/output colorimetry. vpp may fail or produce unexpected results.
buffer [ivs]: dts: CLOCK_TIME_NONE, pts: 0:00:00.046566344
0:00:00.135119782 447450 0x269d8c0 ERROR vaapi gstvaapiencoder.c:344:gst_vaapi_encoder_encode_and_queue: failed to encode frame (status = -1)
0:00:00.135167307 447450 0x269d8c0 ERROR vaapiencode gstvaapiencode.c:704:gst_vaapiencode_handle_frame: failed to encode frame 0 (status -1)
buffer [ivs]: dts: CLOCK_TIME_NONE, pts: 0:00:00.079899677
0:00:00.167429524 447450 0x269d980 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<ivs> error: Internal data stream error.
0:00:00.167465167 447450 0x269d980 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<ivs> error: streaming stopped, reason error (-5)
0:00:00.167567113 447450 0x269d980 WARN queue gstqueue.c:990:gst_queue_handle_sink_event:<qvaapiencin> error: Internal data stream error.
0:00:00.167582393 447450 0x269d980 WARN queue gstqueue.c:990:gst_queue_handle_sink_event:<qvaapiencin> error: streaming stopped, reason error (-5)
[dec_pipe]: 0:00:01.422398173/0:00:09.998433074
[enc_pipe]: 0:59:59.999999999/0:59:59.999999999
[dec_pipe]: 0:00:02.422285087/0:00:09.998433074
[enc_pipe]: 0:59:59.999999999/0:59:59.999999999
[dec_pipe]: 0:00:03.422258709/0:00:09.998433074
[enc_pipe]: 0:59:59.999999999/0:59:59.999999999
These are the two pipelines I'm running:
pipeline0 = Gst.parse_launch(
"filesrc name=fsrc location={} ! " \
"tsdemux name=td td.video_0_0041 ! h264parse ! " \
"queue name=qvaapidecin ! vaapidecodebin ! " \
"video/x-raw,format=NV12,width=1920,height=1080 ! " \
"queue name=qvaapidecout ! " \
"video/x-raw,format=NV12,width=1920,height=1080 ! " \
"intervideosink channel=ch0".format(filename)
)
pipeline1 = Gst.parse_launch(
"intervideosrc channel=ch0 name=ivs ! " \
"video/x-raw,format=NV12,width=1920,height=1080 ! " \
"queue name=qvaapiencin ! vaapih264enc " \
"rate-control=4 bitrate=25000 ! video/x-h264,profile=high ! " \
"queue name=qvaapiencout ! " \
"fakesink name=fk dump=0"
)
However, if you merge both of the pipelines into 1 but keeping the inter
video, the pipeline works fine.
Hardware and GStreamer info
- GStreamer and and vaapi plugin version tested:
1.17.2.1
- Driver:
$ vainfo
libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.8 (libva 2.8.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Sandybridge Mobile - 2.4.1
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
Sample code to reproduce the issue
Here, the 2 scripts I've prepared with the issue:
-
Example with 2 pipes: vaapi_test0.py
-
Example with 1 pipe: vaapi_test1.py
Command-line:
GST_DEBUG="vaapien*:9" python3 vaapi_test0.py test.ts
To generate the input test file, I'm using the following:
gst-launch-1.0 -e videotestsrc blocksize=3110400 num-buffers=300 ! \
video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! \
vaapih264enc rate-control=4 bitrate=25000 ! video/x-h264,profile=high ! queue ! \
multiqueue name=mq ! mpegtsmux name=mux ! tsparse ! filesink location=test.ts \
audiotestsrc ! audio/x-raw,channels=2,layout=interleaved,rate=44100 ! mq. mq. ! \
audioconvert ! faac ! mux.
Any thoughts?