Search code examples
ffmpegraspberry-pih.264hevch.265

Raspberry Pi how to convert RTSP stream h265 to h264


I am trying to convert H265 rtsp stream to H264.

ffmpeg -rtsp_transport tcp -i 'rtsp://admin:admin123@192.168.1.42:554/stream2' -f lavfi -i aevalsrc=0 -vcodec copy -acodec aac -map 0:0 -map 1:0 -c:v libx264 -pix_fmt yuv420p -shortest -strict experimental -f flv rtmp://localhost:1935/live/stream

When I use this command it gives this error.

[tcp @ 0x23f13b0] Connection to tcp://localhost:1935 failed: Connection refused
[rtmp @ 0x23f1270] Cannot open connection tcp://localhost:1935
rtmp://localhost:1935/live/stream: Connection refused

Solution

  • If FFmpeg should act as a server you must add the parameter -listen 1.

    ffmpeg -i 'rtsp://admin:admin123@192.168.1.42:554/stream2' {...} -f flv -listen 1 rtmp://localhost:1935/live/stream