Reputation: 1430
I'm already searching for a solution for several days how to convert an MJPEG rtp stream to MP4 rtp stream.
Already tried something like this:
ffmpeg -i rtsp://192.168.10.8:554/stream1/mobotix.mjpeg -rtsp_transport tcp -f H264 udp://192.168.10.5:8554
ffmpeg then shows me like it's doing something...
frame= 612 fps= 11 q=25.0 size= 3243kB time=00:00:56.00 bitrate= 474.4kbits/s dup=275 drop=0 speed=0.981x
Then I tried with VLC to open udp://192.168.10.5:8554 but it opens nothing simply the bar is running left/right forever.
Do I need something like Simple RTP-Server (https://github.com/ossrs/srs) and then stream to that?
Best would be, when ffmpeg could host rtp itself...
Upvotes: 0
Views: 1456
Reputation: 81
Here is what I used to stream a local mkv to RTP
ffmpeg -re -thread_queue_size 4 -i input.mkv -strict -2 -vcodec copy -an -f rtp rtp://127.0.0.1:6005 -acodec copy -vn -sdp_file my_sdp_file -f rtp rtp://127.0.0.1:7005
I then had to copy the generated sdp file to the client and used ffmpeg to save the stream to disk
ffmpeg -protocol_whitelist "file,rtp,udp" -i my_sdp_file -strict -2 saved_rtp_stream.mp4
For completeness, here are the contents of the sdp file
$ cat my_sdp_file
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 57.83.100
m=video 6005 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AHuiAWh7f+AEAANiAAAH0gABdwHAwABAFgABVc0lGAPFi0SA=,aOvssg==; profile-level-id=4D401E
m=audio 7005 RTP/AVP 97
c=IN IP4 127.0.0.1
a=rtpmap:97 MPEG4-GENERIC/48000/2
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1190
Upvotes: 0