I am developing a function that converts RTSP files to HLS and displays them in a web browser (chrome). Development is node.js, I am using ffmpeg.
The part that is converted to HLS and displayed on the screen plays well without any problems. Video cannot be played the moment the folder is changed for file management.
This is the existing working ffmpeg code and m3u8 code.
ffmpeg -rtsp_transport tcp -i rtsp://210.99.70.120:1935/live/cctv001.stream -c:v copy -f hls -hls_time 1 -hls_segment_type mpegts -hls_flags delete_segments+independent_segments+omit_endlist -hls_list_size 0 -master_pl_name playlist.m3u8 -hls_segment_filename /Users/name/Movies/cam/1/hls/1684560902700_%06d.ts -var_stream_map v:0 /Users/name/Movies/cam/1/hls/1684560902700_playlist.m3u8
Local Path : /Users/name/Movies/cam/1/hls/1684560902700_playlist.m3u8
EndPoint : http://localhost:3000/video/cam/1/hls/1684560902700_playlist.m3u8
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:2.000000,
1684560902700_000000.ts
#EXTINF:1.969000,
1684560902700_000001.ts
#EXTINF:2.000000,
1684560902700_000002.ts
#EXTINF:2.015000,
1684560902700_000003.ts
This is the ffmpeg code and the m3u8 code with the path added.(Video not played)
ffmpeg -rtsp_transport tcp -i rtsp://210.99.70.120:1935/live/cctv001.stream -c:v copy -f hls -hls_time 1 -hls_segment_type mpegts -hls_flags delete_segments+independent_segments+omit_endlist -hls_list_size 0 -master_pl_name playlist.m3u8 -hls_segment_filename /Users/name/Movies/cam/1/hls/1684561736286/cam_%06d.ts -var_stream_map v:0 /Users/name/Movies/cam/1/hls/1684561736286/playlist.m3u8
Local Path : /Users/name/Movies/cam/1/hls/1684561736286/playlist.m3u8
EndPoint : http://localhost:3000/video/cam/1/hls/1684561736286/playlist.m3u8
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:1.986000,
cam_000000.ts
#EXTINF:1.984000,
cam_000001.ts
#EXTINF:2.000000,
cam_000002.ts
#EXTINF:2.000000,
cam_000003.ts
The difference is the file name and the folder created one step further.
If you change POSIX from file name to folder name, you will not know the problem of not playing the video. Can someone please explain this?