I'd like to set up FFmpeg to receive an RTMP stream. Eventually I will be transcoding the Audio and Video, using the mpegts format type, and making the output a UDP multicast.
But for now, this is what I've been working from:
.\ffmpeg.exe -listen 1 -i rtmp://0.0.0.0:9090/stream -c copy -f flv C:\temp\output.flv
This almost works. It creates the file and it has an audio track, but no video track.
Output from ffmpeg shows that the video comes a couple thousand bytes after the audio and video, so it seems that ffmpeg ignores it:
[rtmp @ 000002ad65cca540] Erroneous C2 Message epoch does not match up with C1 epoch
[rtmp @ 000002ad65cca540] Erroneous C2 Message random does not match up
[rtmp @ 000002ad65cca540] App field don't match up: <-> muskiefootball
Input #0, flv, from 'rtmp://0.0.0.0:9095/test':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Wildlife Sample Video - https://archive.org/details/WildlifeSampleVideo
encoder : Lavf58.29.100
Duration: 00:00:00.00, start: 5.677000, bitrate: N/A
Stream #0:0: Data: none
Stream #0:1: Subtitle: text
Stream #0:2: Audio: aac (LC), 44100 Hz, stereo, fltp, 130 kb/s
File 'C:\temp\testingoutput5.flv' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:2 -> #0:0 (aac (native) -> mp2 (native))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'C:\temp\testingoutput5.flv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Wildlife Sample Video - https://archive.org/details/WildlifeSampleVideo
encoder : Lavf58.29.100
Stream #0:0: Audio: mp2, 44100 Hz, stereo, s16, 192 kb/s
Metadata:
encoder : Lavc58.54.100 mp2
[flv @ 000002ad65cc9400] New video stream 0:3 at pos:26340 and DTS:7.163s
size= 1411kB time=00:00:54.29 bitrate= 212.9kbits/s speed=1.05x
So the video isn't included in the output.
What options do I have to allow ffmpeg to include the video in the output when it comes in after the start of the stream? The only limitation is that I have to listen for an RTMP connection, and since it comes from an outside service I can't modify anything about how they send the data.
... -analyzeduration 20M -probesize 20M -i rtmp://0.0.0.0:9090/stream ...