Opened 4 months ago

Closed 4 months ago

#7142 closed defect (needs_more_info)

Not stable fps in delivery rtmp stream

Reported by: pavel.khilko Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: fps
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

When flipping a thread with a given fps using the -vf "fps = 30" filter at the output when delivered, the value of fps fluctuates from 20 to 50-60 peaks.
The delivery of frames is controlled by ffprobe, which displays video frames and the code on JS counts the number of frames that came in a second.

This behavior is observed only with non-stable input stream, provided uniform and stable flow of this problem at the output ffmpeg is not observed.
Also, if we analyze Freeman by comparing the pkt_pts_time of received frames, the value of fps remains stable and equal to 30, as specified in the command.

For video analysis, use the module "video-quality-tools"

How to reproduce:

  • Emulate the incoming stream with delays in delivery
  • Accept ffmpeg input at this prompt
  • Output stream also will not have stable fps
% ffmpeg -i rtmp://localhost/myapp/myStream -s 1280x720 -aspect 16:9 \
-c:a aac -b:a 64k -ac 2 -ar 44100 -c:v libx264 -b:v 1500k -minrate 1500k \
-maxrate 1500k -bufsize 700k -profile:v main -level 4.0 -vf "fps=30,format=yuv420p" \
-x264opts "keyint=60:min-keyint=60:no-scenecut" -preset veryfast \
-tune zerolatency -threads 0 -f flv rtmp://localhost/myapp/myStream1

ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (3)

comment:1 Changed 4 months ago by cehoyos

  • Priority changed from important to normal
  • Version changed from 3.4 to unspecified

Please test current FFmpeg git head, try to simplify the command line you tested and provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

comment:2 Changed 4 months ago by pavel.khilko

ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --prefix=/home/pavlo/.linuxbrew/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=gcc-5 --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/home/pavlo/.linuxbrew/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

I get the stream from webcam with ffmpeg and publish it to nginx-rtmp:

ffmpeg -f alsa -i default -f video4linux2 -i / dev / video0 -c: v libx264 -c: a aac -f flv rtmp: localhost / myapp / myStream

After that, I get stream from nginx-rtmp to ffmpeg and transcode to the required format:

ffmpeg -i rtmp: localhost / myapp / myStream -s 1280x720 -aspect 16: 9 \
-c: a aac -b: a 64k -ac 2 -a 44100 -c: v libx264 -b: v 1500k -minate 1500k \
-maxrate 1500k -bufsize 700k -profile: v main-level 4.0 -vf "fps = 30, format = yuv420p" \
-x264opts "keyint = 60: min-keyint = 60: no-scenecut" -preset veryfast \
-tune zerolatency -threads 0 -f flv rtmp:
localhost / myapp / myStream1

Using the "video-quality-tools" module, I check the delivery time of the frames.
If there is a problem with the incoming stream from the camera, ffmpeg does not save the set value in fps = 30 when delivering the tape

comment:3 Changed 4 months ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.