y4menc: produces bogus output when linked to avdec_h264
Describe your issue
Linking avdec_h26 to y4menc produces invalid output.
Expected Behavior
avdec_h264 ! y4menc
should work as caps negotiation succeed and the pipeline throws no errors.
Observed Behavior
y4menc produces bogus output frames when linked to avdec_h264.
Setup
- Operating System: macOS Monterey & Debian Bookworm
- Device: Computer (macOS) & Docker (Debian Bookworm)
- GStreamer Version: 1.22.4 from Homebrew & 1.22.0 from apt-get
-
Command line:
gst-launch-1.0 filesrc location=sample.h264 ! h264parse ! avdec_h264 ! y4menc ! filesink location=out.y4m
Steps to reproduce the bug
- Generate sample.h264 with ffmpeg (version 6.0):
ffmpeg -f lavfi -i testsrc -c:v libx264 -frames:v 3 -pix_fmt yuv420p sample.h264
- Run the following pipeline:
gst-launch-1.0 filesrc location=sample.h264 ! h264parse ! avdec_h264 ! y4menc ! filesink location=out.y4m
How reproducible is the bug?
100% reproducible afaics.
Screenshots if relevant
Expected output:
Actual output:
Solutions you have tried
On macOS, replacing avdec_h264 with vtdec worked: gst-launch-1.0 filesrc location=sample.h264 ! h264parse ! vtdec ! videoconvert ! y4menc ! filesink location=out.y4m
.
Also, not using y4menc and just muxing raw frames into MP4 with qtmux worked: gst-launch-1.0 filesrc location=sample.h264 ! h264parse ! avdec_h264 ! videoconvert ! qtmux ! filesink location=out.mp4
.
Adding a videoconvert between avdec_h264 and y4menc didn't help though.
Additional Information
Logs from `gst-launch-1.0 -v filesrc location=sample.h264 ! h264parse ! avdec_h264 ! identity silent=false ! y4menc ! filesink location=out.y4m`
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: stream-start (10254), GstEventStreamStart, stream-id=(string)8860956d5d3f300ef199a24dd26719af10ff783128b4ff5f091cadae03f4c94c, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;) 0x600002f06290
Redistribute latency...
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.3, codec_data=(buffer)0164000dffe100196764000dacd94141fb011000000300100000030320f142996001000668ebe3cb22c0
Redistribute latency...
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.3, codec_data=(buffer)0164000dffe100196764000dacd94141fb011000000300100000030320f142996001000668ebe3cb22c0
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: caps (12814), GstEventCaps, caps=(GstCaps)"video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ interlace-mode\=\(string\)progressive\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ chroma-site\=\(string\)mpeg2\,\ framerate\=\(fraction\)25/1";) 0x600002f01c70
/GstPipeline:pipeline0/GstIdentity:identity0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstY4mEncode:y4mencode0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstIdentity:identity0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, framerate=(fraction)25/1
Redistribute latency...
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: segment (17934), GstEventSegment, segment=(GstSegment)"segment, flags=(GstSegmentFlags)GST_SEGMENT_FLAG_NONE, rate=(double)1, applied-rate=(double)1, format=(GstFormat)time, base=(guint64)0, offset=(guint64)0, start=(guint64)0, stop=(guint64)18446744073709551615, time=(guint64)0, position=(guint64)0, duration=(guint64)18446744073709551615;";) 0x600002f11ab0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: tag (20510), GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.264\\\ \\\(High\\\ Profile\\\)\"\;";) 0x600002f11c00
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (149760 bytes, dts: none, pts: 0:00:00.000000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1, flags: 00000040 discont , meta: GstVideoMeta, GstVideoSEIUserDataUnregisteredMeta) 0x7f7924f49460
/GstPipeline:pipeline0/GstY4mEncode:y4mencode0.GstPad:src: caps = application/x-yuv4mpeg, y4mversion=(int)2, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)25/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = application/x-yuv4mpeg, y4mversion=(int)2, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)25/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (149760 bytes, dts: none, pts: 0:00:00.040000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1, flags: 00000000 , meta: GstVideoMeta) 0x7f7925a87d00
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (149760 bytes, dts: none, pts: 0:00:00.080000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1, flags: 00000000 , meta: GstVideoMeta) 0x7f7925a8a670
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: eos (28174), ) 0x600002f11c70
Got EOS from element "pipeline0".
Execution ended after 0:00:00.001184000
Setting pipeline to NULL ...
Freeing pipeline ...