Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
786 views
in Technique[技术] by (71.8m points)

camera - ffmpeg rtsp record segment and folder-file name

I am trying to record an rtsp stream comming from an ip camera. The record with simplified format will start and working as expected. However extending with parameters i am failed at this time.

In theory, the documentation said that we can use folder/filename creation with strftime_mkdir parameter - without success.

cmd:

F_LOG="-y -loglevel verbose -hide_banner -rtsp_transport tcp"
F_PAR1="-c copy -map 0 -map -0:a -f segment -segment_time 300 -segment_format mp4"
F_PAR2="-stimeout 8000 -strftime 1 -strftime_mkdir 1"
#--------------------
CAM1_NAME="CAM1"
CAM1_LINK="rtsp://123:[email protected]:554/Streaming/Channels/101/"

ffmpeg $F_LOG -i $CAM1_LINK $F_PAR1 $F_PAR2 '%Y/%m/%d/file-%Y%m%d-%s.mp4'

output:

[tcp @ 0x55b6302edcc0] Starting connection attempt to 192.168.1.5 port 554
[tcp @ 0x55b6302edcc0] Successfully connected to 192.168.1.5 port 554
[rtsp @ 0x55b6302eba00] SDP:
v=0
o=StreamingServer 3331435948 1116907222000 IN IP4 192.168.1.5
s=h264.mp4
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
a=control:trackID=0
a=rtpmap:96 H265/90000
a=videoinfo:2560*1440*20*4096
m=audio 0 RTP/AVP 0
a=control:trackID=1
a=rtpmap:0 PCMU/8000
a=ptime:20


[rtsp @ 0x55b6302eba00] setting jitter buffer size to 0
    Last message repeated 1 times
[rtsp @ 0x55b6302eba00] max_analyze_duration 5000000 reached at 5034444 microseconds st:0
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://123:[email protected]:554/Streaming/Channels/101/':
  Metadata:
    title           : h264.mp4
  Duration: N/A, start: 0.066667, bitrate: N/A
    Stream #0:0: Video: hevc (Main), 1 reference frame, yuv420p(tv), 2560x1440, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
[segment @ 0x55b6302f2b80] Selected stream id:0 type:video
[mp4 @ 0x55b630302280] Invalid segment filename template '%Y/%m/%d/file-%Y%m%d-%s.mp4'
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times
Press any key to continue...

My intension is to record the camera stream, have a separated 5min files, in a structured format. thats it - any hints are highly appreciated.

Thanks in advance for any suggestion, fix , improvement.

question from:https://stackoverflow.com/questions/65880080/ffmpeg-rtsp-record-segment-and-folder-file-name

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...