IMX95 v4l2h264enc 编码帧损坏 我正在使用 IMX95 的 v4l2h264enc 编码器来测试 H264 视频编码。测试命令行如下: gst-用上市,不用发布-1.0-v videotestsrc pattern=ball num-buffers=150 !video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !v4l2h264enc!文件接收器位置=enc_test.h264 视频文件已成功生成,但当我尝试使用 ffplay 播放时,播放失败并显示以下错误: ffplay 版本 4.2.7-0ubuntu0.1版权所有 (c) 2003-2022 FFmpeg 开发人员 使用 gcc 9 构建(Ubuntu 9.4.0-1ubuntu1~20.04.1) 配置:--prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --启用 nvenc --启用 chromaprint --启用 frei0r --启用 libx264 --启用共享 libavutil 56。31.100 / 56。31.100 libavcodec 58。54.100 / 58.54.100 libavformat 58。29.100 / 58。29.100 libavdevice 58。8.100 / 58。8.100 libavfilter 7.57.100 / 7.57.100 libavresample 4.0.0 / 4.0.0 libswscale 5.5.100 / 5.5.100 libswresample 3.5.100 / 3.5.100 libpostproc 55.5.100 / 55.5.100 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] sps_id 0 超出范围 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了 2 次 [h264 @ 0x7fbea4002840] 超读 VUI 8 位 0KB 平方 = 0B f = 0/0 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 8 位 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了26次 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] sps_id 0 超出范围 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了 29 次 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] sps_id 0 超出范围 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了 29 次 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] sps_id 0 超出范围 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了 29 次 [h264 @ 0x7fbea4002840] 读取 VUI 时超出 7 位 [h264 @ 0x7fbea4002840] sps_id 0 超出范围 [h264 @ 0x7fbea4002840] 引用了不存在的 PPS 0 最后一条消息重复了 29 次 输入 #0,h264,来自'enc_test.h264': 时长:不适用,比特率:不适用 流 #0:0:视频:h264(基线),yuv420p,1280x720,25.17 fps,25 tbr,1200k tbn,50 tbc [h264 @ 0x7fbea4007f00] 读取 VUI 时超出 8 位 无法打开文件“enc_test.h264”或配置滤光图 从上面的日志来看,视频磁头似乎已损坏。 然后我尝试使用 gstreamer debug,并发现了以下日志: 0:00:05.727025935 13024 0xffffa0000d00 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: 由于输入帧消失,无法复制元数据。 我的系统信息:Linux imx95-19x19-lpddr5-evk 6.12.49+ #9 SMP PREEMPT Wed Jul 22 11:47:53 UTC 2026 aarch64 GNU/Linux Re: IMX95 v4l2h264enc encoded frame corrupted 与AE团队讨论。 Re: IMX95 v4l2h264enc encoded frame corrupted 根据您的提示,我尝试执行您提供的两条命令行。但它们都不管用。编码后的视频仍然无法播放。 命令如下: gst-launch-1.0 -e -v videotestsrc pattern=ball num-buffers=150 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! v4l2h264enc ! h264parse config-interval=-1 ! filesink location=enc_test.h264 当我尝试播放编码后的视频文件时,出现以下错误: ffprobe version 4.2.7-0ubuntu0.1 Copyright (c) 2007-2022 the FFmpeg developers built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [h264 @ 0x557b5dc1e980] Format h264 detected only with low score of 1, misdetection possible! [h264 @ 0x557b5dc20380] sps_id 0 out of range Last message repeated 1 times [h264 @ 0x557b5dc20380] non-existing PPS 0 referenced Last message repeated 2 times [h264 @ 0x557b5dc20380] sps_id 0 out of range Last message repeated 1 times [h264 @ 0x557b5dc20380] non-existing PPS 0 referenced [h264 @ 0x557b5dc20380] decode_slice_header error [h264 @ 0x557b5dc20380] no frame! [h264 @ 0x557b5dc20380] non-existing PPS 0 referenced [h264 @ 0x557b5dc20380] decode_slice_header error ...... Last message repeated 1 times [h264 @ 0x557b5dc20380] decode_slice_header error [h264 @ 0x557b5dc20380] no frame! [h264 @ 0x557b5dc1e980] decoding for stream 0 failed [h264 @ 0x557b5dc1e980] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, h264, from 'enc_test.h264': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264, none, 25.17 fps, 25 tbr, 1200k tbn, 50 tbc 我尝试调试,结果出现了如下警告: 0:00:00.129727669 2003 0xffffa8000b70 WARN v4l2bufferpool gstv4l2bufferpool.c:884:gst_v4l2_buffer_pool_start: Uncertain or not enough buffers, enabling copy threshold 0:00:00.152626502 2003 0xffffa8000d00 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: Can't copy metadata because input frame disappeared 0:00:00.153013002 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:435:gst_h264_parse_vui_parameters: failed to read uint8 for 'vui->aspect_ratio_idc', nbits: 8 0:00:00.153052211 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:516:gst_h264_parse_vui_parameters: error parsing "VUI Parameters" 0:00:00.153071752 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2155:gst_h264_parse_sps: error parsing "Sequence parameter set" 0:00:00.153092044 2003 0xffffa8000d00 WARN h264parse gsth264parse.c:993:gst_h264_parse_process_nal: failed to parse SPS: 0:00:00.153120336 2003 0xffffa8000d00 WARN h264parse gsth264parse.c:1529:gst_h264_parse_handle_frame: broken/invalid nal Type: 7 SPS, Size: 9 will be dropped 0:00:00.153205086 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2284:gst_h264_parse_pps: couldn't find associated sequence parameter set with id: 0 0:00:00.153230627 2003 0xffffa8000d00 WARN h264parse gsth264parse.c:1026:gst_h264_parse_process_nal: failed to parse PPS: 0:00:00.153418211 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0 0:00:00.153690127 2003 0xffffa8000d00 WARN v4l2bufferpool gstv4l2bufferpool.c:491:gst_v4l2_buffer_pool_alloc_buffer: newly allocated buffer 0 is not free Pipeline is PREROLLED ... Setting pipeline to PLAYING ... Redistribute latency... New clock: GstSystemClock 0:00:00.180972628 2003 0xffffa8000d00 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: Can't copy metadata because input frame disappeared 0:00:00.181182169 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0 0:00:00.211927795 2003 0xffffa8000d00 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: Can't copy metadata because input frame disappeared 0:00:00.212148128 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0 0:00:00.242748712 2003 0xffffa8000d00 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: Can't copy metadata because input frame disappeared 0:00:00.242969462 2003 0xffffa8000d00 WARN codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0 命令如下: gst-launch-1.0 -e -v videotestsrc pattern=ball num-buffers=150 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! v4l2h264enc ! h264parse config-interval=-1 ! mp4mux ! filesink location=enc_test.mp4 视频文件无法编码,显示如下错误: root@imx95-19x19-lpddr5-evk:~# GST_DEBUG=3 gst-launch-1.0 -e -v videotestsrc pattern=ball num-buffers=150 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! v4l2h264enc ! h264parse config-interval=-1 ! mp4mux ! filesink location=enc_test.mp4 Setting pipeline to PAUSED ... ====== V4L2ENC: 1.24.7 build on Jan 2 2025 07:23:23. ====== 0:00:00.078378376 2059 0xaaaadecda320 WARN v4l2 gstv4l2object.c:5350:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument 0:00:00.079377793 2059 0xffffa8000b70 WARN aggregator gstaggregator.c:2283:gst_aggregator_query_latency_unlocked: Latency query failed Pipeline is PREROLLING ... 0:00:00.079857126 2059 0xffffa8000d00 FIXME default gstutils.c:4089:gst_element_decorate_stream_id_internal: Creating random stream-id, consider implementing a deterministic way of creating a stream-id /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1, multiview-mode=(string)mono, interlace-mode=(string)progressive, colorimetry=(string)bt601, pixel-aspect-ratio=(fraction)1/1 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1, multiview-mode=(string)mono, interlace-mode=(string)progressive, colorimetry=(string)bt601, pixel-aspect-ratio=(fraction)1/1 /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)baseline, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)baseline, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono Redistribute latency... /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1, multiview-mode=(string)mono, interlace-mode=(string)progressive, colorimetry=(string)bt601, pixel-aspect-ratio=(fraction)1/1 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1, multiview-mode=(string)mono, interlace-mode=(string)progressive, colorimetry=(string)bt601, pixel-aspect-ratio=(fraction)1/1 0:00:00.140337252 2059 0xffffa8000d00 WARN v4l2bufferpool gstv4l2bufferpool.c:884:gst_v4l2_buffer_pool_start: Uncertain or not enough buffers, enabling copy threshold 0:00:00.165691544 2059 0xffffa8000e90 FIXME videoencoder gstvideoencoder.c:2408:gst_video_encoder_transform_meta_unlocked: Can't copy metadata because input frame disappeared 0:00:00.166079919 2059 0xffffa8000e90 WARN codecparsers_h264 gsth264parser.c:435:gst_h264_parse_vui_parameters: failed to read uint8 for 'vui->aspect_ratio_idc', nbits: 8 0:00:00.166119002 2059 0xffffa8000e90 WARN codecparsers_h264 gsth264parser.c:516:gst_h264_parse_vui_parameters: error parsing "VUI Parameters" 0:00:00.166138877 2059 0xffffa8000e90 WARN codecparsers_h264 gsth264parser.c:2155:gst_h264_parse_sps: error parsing "Sequence parameter set" 0:00:00.166159335 2059 0xffffa8000e90 WARN h264parse gsth264parse.c:993:gst_h264_parse_process_nal: failed to parse SPS: 0:00:00.166187127 2059 0xffffa8000e90 WARN h264parse gsth264parse.c:1529:gst_h264_parse_handle_frame: broken/invalid nal Type: 7 SPS, Size: 9 will be dropped 0:00:00.166277252 2059 0xffffa8000e90 WARN codecparsers_h264 gsth264parser.c:2284:gst_h264_parse_pps: couldn't find associated sequence parameter set with id: 0 0:00:00.166301710 2059 0xffffa8000e90 WARN h264parse gsth264parse.c:1026:gst_h264_parse_process_nal: failed to parse PPS: 0:00:00.166486835 2059 0xffffa8000e90 WARN codecparsers_h264 gsth264parser.c:2473:gst_h264_parser_parse_slice_hdr: couldn't find associated picture parameter set with id: 0 0:00:00.166826460 2059 0xffffa8000b70 WARN qtmux gstqtmux.c:6357:gst_qt_mux_video_sink_set_caps: no codec_data in h264 caps 0:00:00.166923502 2059 0xffffa8000b70 WARN qtmux gstqtmux.c:6856:gst_qt_mux_video_sink_set_caps: pad video_0 refused caps video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)1, profile=(string)baseline, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, i/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)1, profile=(string)baseline, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, parsed=(boolean)true nterlace-mode=(string)progressive, colorimetry=(string)bt601, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, parsed=(boolean)true 0:00:00.166977794 2059 0xffffa8000e90 WARN v4l2bufferpool gstv4l2bufferpool.c:491:gst_v4l2_buffer_pool_alloc_buffer: newly allocated buffer 0 is not free /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstQTMuxPad:video_0: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)1, profile=(string)baseline, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, parsed=(boolean)true 0:00:00.167488335 2059 0xffffa8000b70 FIXME basesink gstbasesink.c:3399:gst_base_sink_default_event: stream-start event without group-id. Consider implementing group-id handling in the upstream elements /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstAggregatorPad:src: caps = video/quicktime, variant=(string)iso /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)iso Pipeline is PREROLLED ... Setting pipeline to PLAYING ... 0:00:00.168202544 2059 0xffffa8000b70 WARN qtmux gstqtmux.c:5415:gst_qt_mux_add_buffer: error: format wasn't negotiated before buffer flow on pad video_0 Redistribute latency... ERROR: from element /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: GStreamer error: negotiation problem. Additional debug info: /usr/src/debug/gstreamer1.0-plugins-good/1.24.7.imx/gst/isomp4/gstqtmux.c(5415): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: format wasn't negotiated before buffer flow on pad video_0 0:00:00.168413044 2059 0xffffa8000b70 FIXME aggregator gstaggregator.c:1478:gst_aggregator_loop: Subclass should call gst_aggregator_selected_samples() from its aggregate implementation. Execution ended after 0:00:00.000556000 Setting pipeline to NULL ... 0:00:00.174238335 2059 0xaaaadecda320 WARN bufferpool gstbufferpool.c:1429:gst_buffer_pool_set_flushing: can't change flushing state of inactive pool 0:00:00.199404961 2059 0xaaaadecda320 WARN bufferpool gstbufferpool.c:1429:gst_buffer_pool_set_flushing: can't change flushing state of inactive pool Freeing pipeline ... Re: IMX95 v4l2h264enc encoded frame corrupted 编码器输出可能不是来自测试源的“视频头损坏”;该管道缺少 NXP 的 i.MX Linux 指南中针对 i.MX 8 / i.MX 95 VPU 编码器管道所期望的 H.264 解析器阶段。i.MX 95 v4l2h264enc 输出为 H.264 stream-format=byte-stream / alignment=au,NXP 文档指出应该添加 h264parse/h265parse,因为 VPU 在 i.MX 8 和 i.MX 95 上仅支持字节流输出。
请先使用此方法:
gst-用上市,不用发布-1.0-e -v \
videotestsrc pattern=ball num-buffers=150 !\
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !\
v4l2h264enc!\
h264parse 配置间隔=-1!\
filesink location=enc_test.h264
然后直接以原始 H.264 格式播放:
ffplay -f h264 enc_test.h264
如果你想要一个普通的可播放容器文件,请使用复用器:
gst-用上市,不用发布-1.0-e -v \
videotestsrc pattern=ball num-buffers=150 !\
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !\
v4l2h264enc!\
h264解析!\
mp4mux!\
filesink location=enc_test.mp4
或者:
gst-用上市,不用发布-1.0-e -v \
videotestsrc pattern=ball num-buffers=150 !\
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !\
v4l2h264enc!\
h264解析!\
matroskamux!\
filesink location=enc_test.mkv
NXP的录制示例将h264parse置于编码器和复用器/文件接收器路径之间,例如:$videoEncoderPlugin![h264解析]!$MUXER!filesink ...对于 MP4 格式,-e 选项非常重要,这样 GStreamer 才能发送 EOS 并让复用器正确地完成文件。
GStreamer 消息:
视频编码器待修复……由于输入帧消失,无法复制元数据
这本身并不能证明 H.264 比特流头已损坏。这是在 v4l2h264enc 管道中发现的 GStreamer 视频编码器元数据复制警告/FIXME。ffplay 错误——过度读取 VUI、sps_id 0 超出范围、引用不存在的 PPS 0——与下游读取器看到的 H.264 流未按预期规范化/解析的情况更为一致,尤其是在 SPS/PPS 处理方面。
如果解析后的原始 .h264 文件仍然失败,请检查前几个字节:
xxd -l 64 enc_test.h264
对于 Annex-B 字节流 H.264,您应该会看到如下起始代码:
00000001
接近开头,然后是 SPS/PPS NAL 单元,之后是切片。
推荐的解决方法:在 v4l2h264enc 之后插入 h264parse;对于一般播放,建议使用 h264parse!mp4mux!filesink location=enc_test.mp4而不是将编码器输出直接写入原始的 .h264 文件。
Re: IMX95 v4l2h264enc encoded frame corrupted 我们可以使用gstreamer播放h264视频,播放效果很好:
gst-launch-1.0filesrc location=enc_test.h264 !decodebin!glupload!自动视频接收器
所以我觉得这不是 v4l2h264enc 的问题。
查看全文