[FFmpeg-user] stream would stop if given an output format, but not if I use -c copy

John Jon jonjohn218 at yahoo.com
Sun Oct 7 23:24:29 CEST 2012


I am unable to keep a live stream alive for more than 4 minutes if I specify the -f flag, however if I specify '-c copy', the live stream will not break and will continue. The end goal is to restream it through a localhost socket or something along those lines for use in another application.


This seems to work fine, but is not practical as the file will grow in size over time:

ffmpeg -report -i rtmp://170.93.143.150/rtplive/3d01ab5800f700d700437a45351f0214 -c copy dump.flv

But explicitly specifying the output format will break the stream with the eventual error "RTMP_ReadPacket, failed to read RTMP packet body." after 4 minutes every time.
These commands showcase the problem:
ffmpeg -report -i rtmp://170.93.143.150/rtplive/3d01ab5800f700d700437a45351f0214 -f h264 dump2.flv

ffmpeg -report -i rtmp://170.93.143.150/rtplive/3d01ab5800f700d700437a45351f0214 -f h264 udp://localhost:15000

ffmpeg -report -i rtmp://170.93.143.150/rtplive/3d01ab5800f700d700437a45351f0214 -f image2 "frame-%02d.png"

What is curious is that the logs for "-c copy" show the stream skips over the first three minutes:

frame= 1308 fps=0.0 q=-1.0 size=    2089kB time=00:01:27.13 bitrate= 196.4kbits/s     
frame= 2783 fps=2781 q=-1.0 size=    4417kB time=00:03:05.46 195= bitrate.1kbits/s   
 
RTMP_ReadPacket: fd=5
<repeats for numorous times>
frame= 3140 fps=2092 q=-1.0 size=    4985kB time=00:03:29.26 bitrate= 195.2kbits/s    
....

But the "-f" will show the stream starting at 00:00 and end somehwhere at 4 minutes, but will not show the RTMP_ReadPacket littered everywhere:
frame=   50 fps=0.0 q=27.0 size=      13kB time=00:00:00.06 bitrate=1601.2kbits/
frame=   60 fps= 56 q=27.0 size=      19kB time=00:00:00.73 bitrate= 207.8kbits/
frame=   68 fps= 43 q=27.0 size=      26kB time=00:00:01.26 bitrate= 167.2kbits/
....

I have also tried specifying other info to the rtmp such as "live=1, swfVfy=1, swfUrl=<url>" and so forth, but these seem to have no effect, and the live stream is viewable through ffmpeg without them anyway. 

Does anyone here have a clue why this happens or know a possible solution? You can try viewing the stream yourself, but take note that it takes around a minute for ffmpeg to start receiving data from rtmp.

Thanks in advance.


More information about the ffmpeg-user mailing list