Nginx – How to save stream in mp4 format

ffmpegnginxrtmpvideo streaming

By default nginx rtmp module records video stream in .flv format if record option is enabled, but I need .mp4

I found that video can be converted to .mp4 when record has finished with exec_record_done callback and ffmpeg

Is there any way to record video in .mp4 format or at least convert it to this format on the fly?

Best Answer

As far as I know you can't do it on fly. On the other hand, you can just resave it in mp4. You can try to use directly ffmpeg as it supports output https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment Some sort of this, might go: ffmpeg -i rtsp://admin:admin@10.1.1.1:554/ch1-s1 -c copy -map 0 -f segment -segment_time 600 -segment_format mp4 "out%03d.mp4"

Related Topic