Randomly no video with same ffmpeg command

0

Here is command:

ffmpeg -i rtmp://localhost/myapp/obs -c:a libfdk_aac -b:a 32k -c:v libx264 -f flv rtmp://localhost/hls/obs_low

My RTMP server records all published streams, so I can view them all. Strange thing is, while rtmp://localhost/myapp/obs is streaming, if I run the above ffmpeg command, it's only audio in output file, no video. And in terminal output:

Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> aac (libfdk_aac))

But if I run same command again, there could be the video. Randomly, video is there or not. If video is there, I see this output in terminal:

Stream mapping: Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (aac (native) -> aac (libfdk_aac))

Full output of 'audio-only' command: http://pastebin.com/zL0ctvTZ

Full output of 'successful' command: http://pastebin.com/DQ1XJ1wM

user3278087

Posted 2016-08-11T13:22:58.113

Reputation: 3

Just now run above ffmpeg command 20 times in a row. There was video only 12 times. 8 times = just audio. – user3278087 – 2016-08-11T13:39:16.847

Sounds like interleaving gap is large. Try with -analyzeduration 1G -probesize 50M before -i rtmp://... – Gyan – 2016-08-11T14:05:28.103

You're right. Thanks, now every record has video and sound. Any advices on which values should I use just to make sure there always would be video and audio? P.S. If you write an answer, I'll accept it ofcourse. – user3278087 – 2016-08-11T14:36:09.120

what is full console output? If it's MPEG then eah you might need larger analyzeduration – rogerdpack – 2016-08-17T15:39:18.410

Answers

1

Sounds like the interleaving gap is large. Try with -analyzeduration 1G -probesize 50M -i rtmp://... The values present a tradeoff between missing out on streams and the delay in the start of capture, so I'd suggest doing trials. Default value for both analyzeduration and probesize is 5M, so try with slightly larger values till you consistently don't get a stream dropout. Experiment with probesize first. You may not need to specify the other one.

Gyan

Posted 2016-08-11T13:22:58.113

Reputation: 21 016