Reputation: 1811
I want to copy a bunch of SD sources from mpegts transported with RTP on local files. (VBR mpeg2video, mp2 audio). It works fine for one multicast source with the following command:
ffmpeg -i rtp://@IP1:PORT -c copy video1.mpg
but when I ran a second ffmpeg instance with the following command:
ffmpeg -i rtp://@IP2:PORT -c copy video2.mpg
then I got errors from both FFmpeg instances ("RTP: dropping old packet received too late") and in both files (video1.mpg and video2.mpg) recorded video from the second source (rtp://@IP2:PORT).
This issue occurs only in Linux (I checked Ubuntu 14.04 - 16.04). I have no problems in Windows and can transcoding video correctly in parallel from files. Under Ubuntu even two ffplay instances tuned to different sources play back the same content (from the source which was opened last). I tried playing back with VLC and there is no such problem.
I can resolve this issue when using FFmpeg with the -f option:
ffmpeg -f mpegts -i rtp://@IP1:PORT -c copy video1.mpg
and
ffmpeg -f mpegts -i rtp://@IP2:PORT -c copy video2.mpg, but then I'm getting the following errors: "[mpegts @ 0x306e240] PES packet size mismatch" and receive both files (video1.mpg and video2.mpg) with artifacts and freeze effects. This issue appears for both operating systems.
How can I record|transcode videos from multiple RTP streams with FFmpeg simultaneously under Ubuntu without errors and artifacts?
Upvotes: 2
Views: 3799
Reputation: 1811
It's not the best solution, but can resolve this issue.
I run udpxy as follow: udpxy -p 5556
Then run ffmpeg in the following way: ffmpeg -i http://0.0.0.0:5556/rtp/239.255.1.1:5044
Upvotes: 0
Reputation: 31209
Update:
If using a multicast group you may need to set the sources
parameter to receive packets sent from the specified address.
sources=address[,address]
Only receive packets sent to the multicast group from one of the specified sender IP addresses.
ffmpeg -i rtp://[multicast-address]:port?sources=xxx
This is most likely caused by an undersized receive buffer on your Linux machine. Since you mentioned SD it must be set pretty low.
You can get the current value in bytes with:
sysctl net.core.rmem_max
and set a new value with:
sysctl -w net.core.rmem_max=26214400
or edit /etc/sysctl.conf
Upvotes: 3