# Splitmuxsink record time not true

**URL:** <https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585>\
**Category:** Jetson AGX Orin\
**Tags:** gstreamer\
**Created:** [December 12, 2024, 5:03am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585 "2024-12-12T05:03:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha.Chen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Alpha.Chen](https://forums.developer.nvidia.com/u/Alpha.Chen)\
**Post date:** [December 12, 2024, 5:03am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/1 "2024-12-12T05:03:32Z")

</div>

Hi,  
I try use Gstreamer record  
But the 1 minute video only have 57 seconds  
And 6 minutes only have 5m 58s.

I use Python or Gstreamer direct start pipeline  
have same problem.  
How can I fix it?

Thanks!

> Code:

```auto
...
 gst_pipeline = (
        f"nvv4l2camerasrc device={cam_idx} bufapi-version=true ! "
        "video/x-raw(memory:NVMM),width=1920,height=1280,framerate=30/1 ! "
        "nvvideoconvert ! "
        "video/x-raw,width=640,height=480,framerate=30/1,format=BGRx ! "
        "appsink drop=true max-buffers=1 sync=false"
    )

record_pipeline=(
  f"appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! "
  f"videorate max-rate={record_fps} ! nvv4l2h264enc control-rate=0 ! h264parse ! "# 1: 固定碼率CBR (Constant Bitrate) / 0: 動態碼率VBR (Variable Bitrate)
  f"splitmuxsink location={record_path}/{camera_number}/output_{camera_number}_%03d.mp4 max-size-time={max_size_time*Gst.SECOND*60} max-files={max_video_files_length}")

cap = cv2.VideoCapture(gst_pipeline, cv2.CAP_GSTREAMER)
writer = cv2.VideoWriter(record_pipeline, cv2.CAP_GSTREAMER, 30,frame_shape[1::-1])
...

```

> JetsonInfo:

```auto
Software part of jetson-stats 4.2.12 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin - Jetpack 5.1.1 [L4T 35.3.1]
NV Power Mode[0]: MAXN
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - Module: Check with sudo
Platform:
 - Distribution: Ubuntu 20.04 focal
 - Release: 5.10.104-tegra
jtop:
 - Version: 4.2.12
 - Service: Active
Libraries:
 - CUDA: 11.4.315
 - cuDNN: 8.6.0.166
 - TensorRT: 8.5.2.2
 - VPI: 2.2.7
 - Vulkan: 1.3.204
 - OpenCV: 4.10.0 - with CUDA: YES

```

> Video Info:

```auto
mediainfo /media/256G_SSD_1/yolov8-for-jetson/opencv/recordings/0/output_0_001.mp4 
General
Complete name : /media/256G_SSD_1/yolov8-for-jetson/opencv/recordings/0/output_0_001.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (mp42/mp41/isom/iso2)
File size : 49.9 MiB
Duration : 5 min 58 s
Overall bit rate : 1 168 kb/s
Encoded date : UTC 2024-12-12 03:43:47
Tagged date : UTC 2024-12-12 03:53:30

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3
Format settings : 1 Ref Frames
Format settings, CABAC : No
Format settings, Reference frames : 1 frame
Format settings, GOP : M=1, N=30
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 5 min 58 s
Bit rate : 1 168 kb/s
Maximum bit rate : 2 938 kb/s
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 5.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.761
Stream size : 49.9 MiB (100%)
Encoded date : UTC 2024-12-12 03:43:47
Tagged date : UTC 2024-12-12 03:53:30
Codec configuration box : avcC

```

---

<div class="post-metadata">

**Author:** ![carolyuu](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/carolyuu/32/14043_2.png) [@carolyuu](https://forums.developer.nvidia.com/u/carolyuu)\
**Post date:** [December 12, 2024, 7:30am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/3 "2024-12-12T07:30:11Z")

</div>

Hi,  
We support jetson\_multimedia\_api and gstreamer. Please make sure you have checked the document:

> **[Multimedia — NVIDIA Jetson Linux Developer Guide 1 documentation](https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/Multimedia.html)**

> **[Jetson Linux API Reference: Main Page | NVIDIA Docs](https://docs.nvidia.com/jetson/archives/r36.3/ApiReference/index.html)**

There are some examples in

> [@Jetson AGX Orin FAQ](https://forums.developer.nvidia.com/t/jetson-agx-orin-faq/237459):
>
> Q: How to apply PCN210100 overlay patch? PCN210100 is supported from Jetpack 5.1.3. If you are using 5.1.1 or 5.1.2, there are overlay packages in: [Jetson Linux 35.3.1 | NVIDIA Developer](https://developer.nvidia.com/embedded/jetson-linux-r3531)[Jetson Linux 35.4.1 | NVIDIA Developer](https://developer.nvidia.com/embedded/jetson-linux-r3541) If your device is AGX Orin 64GB, please also add the patch mentioned in below link: [AGX orin 64GB flash fail - #3 by DaveYYY](https://forums.developer.nvidia.com/t/agx-orin-64gb-flash-fail/293127/3) Without this patch, Orin AGX 64GB with PCN update may not get flashed Q: I cannot control GPIO in Jetpack 6.0, 6.1 and 6.2, but it works with…

> Q: Is there any example of running RTSP streaming?  
> Q: Is there an example for running UDP streaming?  
> Q: I have a USB camera. How can I launch it on AGX Orin?

For further issues, please share a method to replicate the issue through gstreamer command, or either sample. We will set up developer kit and check.

Thanks!

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [December 12, 2024, 7:50am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/5 "2024-12-12T07:50:27Z")

</div>

Hi,  
You may enable the property:

```auto
  insert-sps-pps : Insert H.264 SPS, PPS at every IDR frame
                        flags: readable, writable
                        Boolean. Default: false

```

And set smaller IDR interval(such as 15, 30, or 60):

```auto
  idrinterval : Encoding IDR Frame occurance frequency
                        flags: readable, writable, changeable only in NULL or READY state
                        Unsigned Integer. Range: 0 - 4294967295 Default: 256

```

---

<div class="post-metadata">

**Author:** ![Alpha.Chen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Alpha.Chen](https://forums.developer.nvidia.com/u/Alpha.Chen)\
**Post date:** [December 13, 2024, 1:25am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/6 "2024-12-13T01:25:05Z")

</div>

It’s can work.  
Thanks.

But I try `nvv4l2h264enc` open perfomace mode  
Set property `maxperf-enable=1`  
Can’t open camera

How can I fix it?  
Thanks!

> Display theese errors:

```auto

(python3:89676): GStreamer-CRITICAL **: 09:51:57.498: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python3:89676): GStreamer-CRITICAL **: 09:51:57.498: gst_structure_get_int: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1079) open OpenCV | GStreamer warning: cannot query video width/height

(python3:89676): GStreamer-CRITICAL **: 09:51:57.498: gst_structure_get_fraction: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1085) open OpenCV | GStreamer warning: cannot query video fps
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

(python3:89677): GStreamer-CRITICAL **: 09:51:57.507: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python3:89677): GStreamer-CRITICAL **: 09:51:57.507: gst_structure_get_int: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1079) open OpenCV | GStreamer warning: cannot query video width/height

(python3:89677): GStreamer-CRITICAL **: 09:51:57.507: gst_structure_get_fraction: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1085) open OpenCV | GStreamer warning: cannot query video fps
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

(python3:89678): GStreamer-CRITICAL **: 09:51:57.512: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python3:89678): GStreamer-CRITICAL **: 09:51:57.512: gst_structure_get_int: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1079) open OpenCV | GStreamer warning: cannot query video width/height

(python3:89678): GStreamer-CRITICAL **: 09:51:57.512: gst_structure_get_fraction: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1085) open OpenCV | GStreamer warning: cannot query video fps
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

(python3:89679): GStreamer-CRITICAL **: 09:51:57.523: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python3:89679): GStreamer-CRITICAL **: 09:51:57.523: gst_structure_get_int: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1079) open OpenCV | GStreamer warning: cannot query video width/height

(python3:89679): GStreamer-CRITICAL **: 09:51:57.523: gst_structure_get_fraction: assertion 'structure != NULL' failed
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1085) open OpenCV | GStreamer warning: cannot query video fps
[WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
[12/13/2024-09:51:58] [TRT] [I] Loaded engine size: 11 MiB
[12/13/2024-09:51:58] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[12/13/2024-09:51:58] [TRT] [I] Loaded engine size: 11 MiB
[12/13/2024-09:51:58] [TRT] [I] Loaded engine size: 11 MiB
[12/13/2024-09:51:58] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[12/13/2024-09:51:58] [TRT] [I] Loaded engine size: 11 MiB
[12/13/2024-09:51:58] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[12/13/2024-09:51:58] [TRT] [W] Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +616, GPU +2273, now: CPU 1011, GPU 13196 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +616, GPU +2395, now: CPU 1011, GPU 13198 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +10, now: CPU 0, GPU 10 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +1, GPU +1, now: CPU 1000, GPU 13188 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +10, now: CPU 0, GPU 10 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +4, now: CPU 1000, GPU 13184 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +617, GPU +2199, now: CPU 1012, GPU 13199 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +18, now: CPU 0, GPU 28 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +10, now: CPU 0, GPU 10 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +3, now: CPU 999, GPU 13195 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +18, now: CPU 0, GPU 28 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +617, GPU +2244, now: CPU 1011, GPU 13205 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +10, now: CPU 0, GPU 10 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +4, now: CPU 1000, GPU 13206 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +18, now: CPU 0, GPU 28 (MiB)
[12/13/2024-09:51:59] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +18, now: CPU 0, GPU 28 (MiB)
H264: Profile = 66, Level = 0 
H264: Profile = 66, Level = 0 
NVMEDIA: Need to set EMC bandwidth : 21000 
NVMEDIA: Need to set EMC bandwidth : 21000 
NVMEDIA_ENC: bBlitMode is set to TRUE 
NVMEDIA_ENC: bBlitMode is set to TRUE 
NvHostHost1xChannelSetModuleClockRate: NvError_IoctlFailed with error code 22
H264: Profile = 66, Level = 0 
NvHostHost1xChannelSetModuleClockRate: NvError_IoctlFailed with error code 22
NVMEDIA: Need to set EMC bandwidth : 21000 
NvHostHost1xChannelSetModuleBandwidth: NvError_IoctlFailed with error code 22
NVMEDIA_ENC: bBlitMode is set to TRUE 
NvHostHost1xChannelSetModuleClockRate: NvError_IoctlFailed with error code 22
H264: Profile = 66, Level = 0 
NVMEDIA: Need to set EMC bandwidth : 21000 
NvHostHost1xChannelSetModuleBandwidth: NvError_IoctlFailed with error code 22
NVMEDIA_ENC: bBlitMode is set to TRUE 
NvHostHost1xChannelSetModuleClockRate: NvError_IoctlFailed with error code 22

```

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [December 13, 2024, 1:52am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/7 "2024-12-13T01:52:34Z")

</div>

Hi,  
Please send frame data in BGR to _appsink_ and try. It seems wrong to send data in BGRx.

---

<div class="post-metadata">

**Author:** ![Alpha.Chen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Alpha.Chen](https://forums.developer.nvidia.com/u/Alpha.Chen)\
**Post date:** [December 13, 2024, 2:14am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/8 "2024-12-13T02:14:15Z")

</div>

Change to BGR Have Same Problem.  
But Display and record is normally running.

> Code:

```auto
gst_pipeline = (
        f"nvv4l2camerasrc device={cam_idx} bufapi-version=true ! "
        "video/x-raw(memory:NVMM),width=1920,height=1280,framerate=30/1 ! "
        "nvvideoconvert ! videoconvert ! "
        f"video/x-raw,width={w},height={h},framerate=30/1,format=BGR ! "
        "appsink drop=true max-buffers=1 async=false sync=false"
    )

gst_out = (
        f"appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! "
        f"videorate max-rate={record_fps} ! nvv4l2h264enc maxperf-enable=1 insert-sps-pps=true idrinterval=15 control-rate=0 ! h264parse ! "
        f"splitmuxsink location={record_path}/{camera_number}/output_{camera_number}_%03d.mp4 max-size-time={max_size_time*Gst.SECOND*60} max-files={max_video_files_length}" 
    )

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [December 27, 2024, 2:14am UTC](https://forums.developer.nvidia.com/t/splitmuxsink-record-time-not-true/316585/9 "2024-12-27T02:14:31Z")

</div>

Closed on December 27, 2024, 2:14am UTC

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