[FFmpeg-user] Detecting end of frame with http protocol
Francois PION-DRANCY
francois.piondrancy at gmail.com
Mon Sep 9 19:41:41 EEST 2024
Hello,
It seems I succedd to redirect rtsp stream to http server with my command.
ffmpeg -y -i rtsp://<login>:<password>@10.126.2.247:554/live -f mpegts
-codec:v mpeg1video -codec:a mp2 -r 30 -b:v 1000k -b:a 128k -bf 0
http://localhost:9999/stream
I code an http server in nodejs which received data...
function videoStreapByHttp(req,res) {
const fn = "videoStreapByHttp"
/* req.url : /stream
*/
nodeLog.log(fn,"stream...")
if (req.method == "POST") {
let body = ''
req.on('data', function (data) {
body += data
nodeLog.log(fn, `frame lengh: ${body.length}`)
})
req.on('end', function () {
res.writeHead(200, { 'Content-Type': 'text/html' })
res.end('done')
app.frameCountByHttpPost++
nodeLog.log(fn, `frame ${app.frameCountByHttpPost} ok`)
})
}
}
But th code never enters req.on('end') as it was an infinite stream of data.
How to identify each frame ?
Or do I need to use an other video encoder ?
Best regards
François PION-DRANCY
More information about the ffmpeg-user
mailing list