Hi,
I try use gstreamer+python
use splitmuxsink split record file,
But when I restart the app,
the file name can’t continue,
It’s overwrite of first file.
And I try theese pipeline use start-index
:
...
# 檢查現有檔案數量以獲取正確的起始索引
output_dir = f"{record_path}/{camera_number}/"
existing_files = [f for f in os.listdir(output_dir) if f.startswith(f"output_{camera_number}_") and f.endswith(".mp4")]
start_index = len(existing_files)
gst_out = (
f"appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! "
f"videorate max-rate={record_fps} ! nvv4l2h264enc 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} "
f"start-index={start_index} next-file=4" # 4 = GST_SPLITMUX_NEXT_FILE_MAX
)
writer = cv2.VideoWriter(gst_out, cv2.CAP_GSTREAMER, 30,frame_shape[1::-1])
...
But the write file still from first file,
I want to continue last file name to next,
Ex:
Last file name is : out_000.mp4
And I restart the app.
Then record file will start in out_001.mp4
How can I do?
Thanks!
JetsonInfo:
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
DaneLLL
December 30, 2024, 2:18am
3
Hi,
You may try the pipeline in gst-launch-1.0 command. We run the command and don’t hit the issue:
$ gst-launch-1.0 -e videotestsrc is-live=1 ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! nvv4l2h264enc insert-sps-pps=true idrinterval=15 control-rate=0 ! h264parse ! splitmuxsink location=video%03d.mp4 muxer=qtmux start-index=5
I try to use theese pipeline direct run on gstreamer,
But the save file not begin on video005
,
It’s still video000
.
pipline and output:
ubuntu@EAC-5000:~/workspaces/yolov8-for-jetson/opencv$ gst-launch-1.0 -e videotestsrc is-live=1 ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! nvv4l2h264enc insert-sps-pps=true idrinterval=15 control-rate=0 ! h264parse ! splitmuxsink location=video%03d.mp4 muxer=qtmux start-index=5
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 0
NVMEDIA: Need to set EMC bandwidth : 126000
NVMEDIA_ENC: bBlitMode is set to TRUE
ls:
DaneLLL
December 31, 2024, 1:53am
5
Hi,
We run the command on developer kit and can see index starting from 5. Are you able to try developer kit?
Not sure if it helps but you can clean the cache for a try:
$ rm ~/.cache/gstreamer-1.0/registry.aarch64.bin
pipeline:
GST_DEBUG=splitmuxsink:6 gst-launch-1.0 -e videotestsrc is-live=1 ! video/x-raw, format=BGR ! queue ! videoconvert ! nvvidconv ! nvv4l2h264enc insert-sps-pps=true idrinterval=15 control-rate=0 ! h264parse ! splitmuxsink location=video%03d.mp4 muxer=qtmux start-index=5 > debug_log.txt 2>&1
Log File:
debug_log.txt (3.8 MB)
DaneLLL
December 31, 2024, 2:28am
8
Hi,
It looks the property start-index is not supported on gstreamer 1.16.3. We searched online and found the solution:
gstreamer - Is it possible to set initial index of splitmuxsink? - Stack Overflow
You may give it a try.
1 Like
All right,I will be try it,
But maybe a few days later.
Thanks!
system
Closed
January 29, 2025, 2:14am
11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.