Closed liujiachang closed 1 year ago
Is your video a live stream? What is the format of the stream url?
nohup ffmpeg -re -stream_loop -1 -i 00-10-00.mp4 -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -b:v 2000k -vf scale=1920:1080 -f rtsp -rtsp_transport tcp rtsp://*****:1508/ai/stream_1k >> nohup.out 2>&1 &
I push local videos to network streams through ffmpeg. stream: rtsp://*****:1508/ai/stream_1k
pkts = ( bmf.graph().decode({ 'input_path': stream, "loglevel": "quiet", })['video'] .start() # this will return a packet generator ) for i, pkt in enumerate(pkts): # convert frame to a nd array if pkt.is_(bmf.VideoFrame): vf = pkt.get(bmf.VideoFrame) rgb = mp.PixelInfo(mp.kPF_RGB24) np_vf = vf.reformat(rgb).frame().plane(0).numpy() # we can add some more processing here, e.g. predicting print("frame", i, "shape", np_vf.shape) else: break
When I used the above code to read the stream, an error occurred. When I switched the video stream to a local video, the error disappeared. I don't know where the problem is, but my video stream is correct. I can use ffmpeg to read the stream and save it as mp4. The following is the error message:
pls double check the "stream" object is a string but not array in decode config when video stream condition
I am certain that the stream object is a string.
After restarting the container, this error disappeared. I think some services may not have started properly. My other question is that when I want to terminate a task while reading the stream, ctrl+c will cause a "Segmentation fault (core dumped)" when terminating the task. What other methods are there to stop the task? The generated 'core. ' file is too large.
that's a good question since the force quit without segfault or block for a while should be a feature need to be optmized
Looking forward to future updates
When I used the above code to read the stream, an error occurred. When I switched the video stream to a local video, the error disappeared. I don't know where the problem is, but my video stream is correct. I can use ffmpeg to read the stream and save it as mp4. The following is the error message: