Webcam to vp8 encoding dont result in a seekable video

Hello! This string generates a video where it is impossible to choose the position.

gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg,format=MJPG,width=1920,height=1080,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2vp8enc bitrate=8000000 ! matroskamux ! filesink location=/home/ances/video.mkv -e

Could someone tell me what I’m doing wrong?

Hi, ances.ai

I have a couple of suggestions:

  • Your pipeline description is incorrect. Do you see any kind of syntax errors? Can you please try (format=MJPG is not valid):
gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2vp8enc bitrate=8000000 ! matroskamux ! filesink location=/home/ances/video.mkv -e

*Also you could try to add jpegparse between v4l2src and the decoder, for example:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg,width=1920,height=1080,framerate=60/1 !  jpegparse ! nvv4l2decoder mjpeg=1 !  nvvidconv ! nvv4l2vp8enc bitrate=8000000 ! matroskamux ! filesink location=/home/ances/video.mkv -e

*Also you could try to simulate your video source and check if the video is seekable, for example:

gst-launch-1.0 videotestsrc is-live=true ! jpegenc ! image/jpeg,format=MJPG,width=1920,height=1080,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2vp8enc bitrate=8000000 ! matroskamux ! filesink location=/home/ances/video.mkv -e

Also can you please share the debug log

GST_DEBUG=2 gst-launch-1.0 -v ...

Jafet Chaves,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hello jchaves, I have tested your examples. All of them works, but the videos are also unseekable. Thankyou for all your suggestions.

This link have a response pretty interesting.

In a nutshell you need to update the duration metadata at the beginning of the file when you stop the recording.

So, If it is true, I will need to rewrite the video with the right metadata, or use a different codec.

Hi, ances.ai

Just out of curiosity. How are you validating that the video are not seekable?

What does the GStreamer debug say?

Jafet Chaves,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

I tried checking the videos with gst-discover. I used this pipeline version to be able to run at 60 fps on a Jetson Nano:

GST_DEBUG=2 gst-launch-1.0 videotestsrc is-live=true num-buffers=600 ! "video/x-raw,format=I420,width=640,height=480,framerate=60/1" !  nvvidconv ! nvjpegenc ! "image/jpeg, width=1920,height=1080,framerate=60/1" ! jpegparse ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2vp8enc ! matroskamux ! filesink location=video.mkv -e

This is the output of gst-discover

Analyzing file:///home/user/video.mkv
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 278 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 278 
Done discovering file:///home/user/video.mkv

Topology:
  container: Matroska
    video: VP8

Properties:
  Duration: 0:00:09.999999600
  Seekable: yes
  Live: no
  Tags: 
      container format: Matroska
      video codec: On2 VP8

I also checked the videos with VLC and I can drag the progress bar to different places and the video would just pick up from there without issues.

Can you please check the videos with gst-discover and a video player (like vlc) too?

Jafet Chaves,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi!

This is a debug output:

Setting pipeline to PAUSED …
Opening in BLOCKING MODE
0:00:00.414678995 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8970790 Failed to determine interlace mode
0:00:00.414771237 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8970790 Failed to determine interlace mode
0:00:00.414831551 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8970790 Failed to determine interlace mode
0:00:00.414893583 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8970790 Failed to determine interlace mode
0:00:00.415006867 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:nvv4l2vp8enc0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
Opening in BLOCKING MODE
0:00:00.461098145 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
0:00:00.461186949 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
0:00:00.461241638 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
0:00:00.461300858 20868 0x55b8986f80 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
NvMMLiteOpen : Block : BlockType = 277
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 277
/GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0.GstPad:sink: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, interlace-mode=(string)progressive
0:00:00.523397473 20868 0x55b895df70 WARN v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:v4l2src0:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:01.039598884 20868 0x55b895df70 WARN v4l2 gstv4l2object.c:4476:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
0:00:01.039655760 20868 0x55b895df70 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
0:00:01.039695240 20868 0x55b895df70 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
0:00:01.039729512 20868 0x55b895df70 WARN v4l2 gstv4l2object.c:2388:gst_v4l2_object_add_interlace_mode:0x55b8968390 Failed to determine interlace mode
/GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0.GstPad:src: caps = video/x-raw(memory:NVMM), format=(string)Y42B, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)2:4:7:1, framerate=(fraction)60/1
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive, 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/nvv4l2vp8enc:nvv4l2vp8enc0.GstPad:src: caps = video/x-vp8, profile=(string)0, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, 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/GstMatroskaMux:matroskamux0.GstMatroskamuxPad:video_0: caps = video/x-vp8, profile=(string)0, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, 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…
NvMMLiteOpen : Block : BlockType = 7
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 7
0:00:01.045949976 20868 0x55b895df70 WARN v4l2bufferpool gstv4l2bufferpool.c:1087:gst_v4l2_buffer_pool_start:nvv4l2vp8enc0:pool:src Uncertain or not enough buffers, enabling copy threshold
/GstPipeline:pipeline0/nvv4l2vp8enc:nvv4l2vp8enc0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive, 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/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw(memory:NVMM), format=(string)Y42B, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)2:4:7:1, framerate=(fraction)60/1
0:00:01.046790882 20868 0x55b895df70 WARN v4l2videodec gstv4l2videodec.c:1755:gst_v4l2_video_dec_decide_allocation: Duration invalid, not setting latency
0:00:01.054387316 20868 0x55b895df70 WARN v4l2bufferpool gstv4l2bufferpool.c:1087:gst_v4l2_buffer_pool_start:nvv4l2decoder0:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:01.063559935 20868 0x7fa00030f0 WARN v4l2bufferpool gstv4l2bufferpool.c:1536:gst_v4l2_buffer_pool_dqbuf:nvv4l2decoder0:pool:src Driver should never set v4l2_buffer.field to ANY
0:00:01.077859919 20868 0x55b895df70 WARN v4l2src gstv4l2src.c:976:gst_v4l2src_create: lost frames detected: count = 4 - ts: 0:00:00.593911882
NVMEDIA_ENC: bBlitMode is set to TRUE
0:00:01.111628396 20868 0x7fa0003a80 WARN v4l2bufferpool gstv4l2bufferpool.c:1536:gst_v4l2_buffer_pool_dqbuf:nvv4l2vp8enc0:pool:src Driver should never set v4l2_buffer.field to ANY
/GstPipeline:pipeline0/GstMatroskaMux:matroskamux0.GstPad:src: caps = video/x-matroska
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-matroska
/GstPipeline:pipeline0/GstMatroskaMux:matroskamux0.GstPad:src: caps = video/x-matroska, streamheader=(buffer)< 1a45dfa301000000000000144282896d6174726f736b610042878102428581021853806701ffffffffffffff114d9b74010000000000008c4dbb010000000000001253ab841549a96653ac88ffffffffffffffff4dbb010000000000001253ab841654ae6b53ac88ffffffffffffffff4dbb010000000000001253ab841043a77053ac88ffffffffffffffff4dbb010000000000001253ab841c53bb6b53ac88ffffffffffffffff4dbb010000000000001253ab841254c36753ac88ffffffffffffffff1549a966010000000000007473a490f4500cda99d4a76219d29fad900335a72ad7b1830f424044898800000000000000004d80a54753747265616d6572206d6174726f736b616d75782076657273696f6e20312e31342e35005741994753747265616d6572204d6174726f736b61206d757865720044618809b1d8857982c2001654ae6b0100000000000046ae010000000000003dd7810183810173c588f5bdae3f27b1983f23e38383fe502a536e86566964656f00e0010000000000000bb0820780ba8204389a81028686565f56503800 >
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-matroska, streamheader=(buffer)< 1a45dfa301000000000000144282896d6174726f736b610042878102428581021853806701ffffffffffffff114d9b74010000000000008c4dbb010000000000001253ab841549a96653ac88ffffffffffffffff4dbb010000000000001253ab841654ae6b53ac88ffffffffffffffff4dbb010000000000001253ab841043a77053ac88ffffffffffffffff4dbb010000000000001253ab841c53bb6b53ac88ffffffffffffffff4dbb010000000000001253ab841254c36753ac88ffffffffffffffff1549a966010000000000007473a490f4500cda99d4a76219d29fad900335a72ad7b1830f424044898800000000000000004d80a54753747265616d6572206d6174726f736b616d75782076657273696f6e20312e31342e35005741994753747265616d6572204d6174726f736b61206d757865720044618809b1d8857982c2001654ae6b0100000000000046ae010000000000003dd7810183810173c588f5bdae3f27b1983f23e38383fe502a536e86566964656f00e0010000000000000bb0820780ba8204389a81028686565f56503800 >
^Chandling interrupt.
Interrupt: Stopping pipeline …
EOS on shutdown enabled – Forcing EOS on the pipeline
Waiting for EOS…
0:00:05.988176159 20868 0x7fa0003a80 WARN v4l2allocator gstv4l2allocator.c:1505:gst_v4l2_allocator_dqbuf:nvv4l2vp8enc0:pool:src:allocator V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
Got EOS from element “pipeline0”.
EOS received - stopping pipeline…
Execution ended after 0:00:05.525393963
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

With a buch of players (windows player, MPV, VLC), and certainly, only VLC allow to seek the video.

Hi,

I don’t see anything out of the ordinary based on the GST_DEBUG log that you provided. Did you try to check the output of gst-discover?

Also I am wondering the different results with other media players. I wonder if the decoding backend (FFmpeg for example) could cause this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.