IMX95 v4l2h264enc エンコードされたフレームが破損しています 私はIMX95のv4l2h264encエンコーダーを使用して、H264ビデオエンコードをテストしています。テストコマンドラインは以下のとおりです。 gst-launch-1.0-v videotestsrc pattern=ball num-buffers=150 !video/x-raw、format=NV12、width=1280、height=720、framerate=30/1 !v4l2h264enc !filesink location=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-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-libopenjp --enable-libopenmpt --enable-libbops --enable-libpulse --enable-librband --enable-libsnand --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvppx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxxvid --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-shared264 リバヴティル 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 sq= 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のデバッグ機能を使ってみたところ、以下のログが見つかりました。 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 2026年7月22日(水)11:47:53 UTC aarch64 GNU/Linux Re: IMX95 v4l2h264enc encoded frame corrupted AEチームと話し合っています。 Re: IMX95 v4l2h264enc encoded frame corrupted あなたのヒントに従って、あなたが提供してくれた2つのコマンドラインを実行してみました。しかし、どれも効果がない。エンコードされた動画はまだ再生できません。 コマンドの場合: 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ガイダンスで期待されるH.264パーサーステージが欠けており、i.MX 8 / i.MX 95 VPUエンコーダパイプラインに期待されています。i.MX 95 v4l2h264encの出力はH.264 stream-format=byte-stream / alignment=auであり、NXPのドキュメントではVPUが i.MX 8および95でバイトストリーム出力のみをサポートするため、h264parse/h265parseを追加すべき i.MX あります。
まずはこちらをお使いください:
gst-launch-1.0-e -v \
videotestsrc パターン=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
次に、それを生のH.264として明示的に再生します。
ffplay -f h264 enc_test.h264
通常の再生可能なコンテナファイルが必要な場合は、マルチプレクサを使用してください。
gst-launch-1.0-e -v \
videotestsrc パターン=ball num-buffers=150 !\
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !\
v4l2h264enc !\
h264parse !\
mp4mux !\
filesink location=enc_test.mp4
または:
gst-launch-1.0-e -v \
videotestsrc パターン=ball num-buffers=150 !\
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 !\
v4l2h264enc !\
h264parse !\
matroskamux !\
filesink location=enc_test.mkv
NXPの録画例では、h264parseをエンコーダーとmuxer/filesinkパスの間に配置しています。例:$videoEncoderPlugin ![h264parse] !$MUXER !ファイルシンク... 。MP4の場合、-eオプションが重要で、GStreamerはEOSを送り、マクサがファイルを正しく最終化できるようにします。
GStreamerメッセージ:
FIXME videoencoder ...入力フレームが消えたためメタデータをコピーできません
それ自体では、H.264ビットストリームヘッダーが破損していることの証明にはなりません。これは、v4l2h264enc パイプラインで確認されている GStreamer ビデオエンコーダーのメタデータコピー警告/FIXME です。ffplayのエラー(Overread VUI、sps_id 0 が範囲外、非存在のPPS 0が参照)は、特にSPS/PPSの処理に関して、ダウンストリームのリーダーが期待どおりに正規化/解析されていないH.264ストリームを見ているという状況とより一致しています。
解析済みの生の.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 !グルプロード!自動ビデオシンク
なので、v4l2h264encの問題ではないと思います。
記事全体を表示