<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">I'm looking for someone with FFmpeg development expertise who can help solve two problems.  </div><div class=""><br class=""></div><div class="">My company has created an RMTP encoder/streamer application using FFmpeg.  The application muxes audio and video from multiple sources, and produces output that it then streams via RTMP, using FFmpeg.  The application runs on macOS, currently on Sierra (10.12.6).   </div><div class=""><br class=""></div><div class="">The problems are as follows:</div><div class=""><br class=""></div><div class="">Issue #1. Our FFmpeg based RTMP encoder produces VERY large frames after changing from a static image input. </div><div class=""><br class=""></div><div class="">The problem evolves as follows:</div><div class=""><br class=""></div><div class="">a. The encoder encodes and streams a still image for 30 or more seconds.  During this time, output frames are of a normal size, and the output bitrate is at or under the specified target bit rate.</div><div class="">b. The content changes to a different, and moving picture..  At this time, the encoder’s output frames are VERY large, and the output bitrate is far above the specified target bit rate.</div><div class="">c. After approximately 30 seconds, the frames sizes return to normal, and the output bitrate of the motion video is roughly equal to the specified target bit rate.</div><div class=""><br class=""></div><div class="">There is a proportional relationship between the duration the static image is encoded in step (a) and the frame size and duration of impact.  </div><div class=""><br class=""></div><div class="">Our encoder settings are set as follows:</div><div class=""><br class=""></div><div class="">Video:</div><div class="">- Codec: H.264</div><div class="">- AVC Level: 4.1</div><div class="">- Data Rate: 1000kbps</div><div class="">- Resolution: 1280x720p</div><div class="">- Keyframe Interval: 2 seconds</div><div class="">- Frames per Second: 30</div><div class="">- Profile: High</div><div class=""><br class=""></div><div class="">Audio:</div><div class="">- Codec: AAC</div><div class="">- Sample Rate: 48,000</div><div class="">- Channels: 2 (Stereo)</div><div class="">- Data Rate 96kbps</div><div class=""><br class=""></div><div class="">FFmpeg command line does not exhibit the same problematic behavior.  FFmpeg produces consistent frame sizes and the output bitrate remains consistent for the duration of the encode/stream.  The following command line is used to in our testing:</div><div class=""><br class=""></div><div class="">ffmpeg -re -i TestPatternVideo.mp4 -b:v 1000k -vcodec h264_videotoolbox -ar 48000 -ab 96k -acodec aac -profile:v high -level:v 4.1 -f flv <a href="rtmp://hostname/appname/live/ffmpeg-test1" class="">rtmp://hostname/appname/live/ffmpeg-test1</a></div><div class=""><br class=""></div><div class="">TestPatternVideo.mp4, which was used in our testing is available here: <a href="https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0" class="">https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0</a></div><div class=""><br class=""></div><div class="">We have also examined the recordings of both the FFmpeg output and of our encoder’s output with FFprobe.  We have converted the FFprobe output to CSV format, so it is easier to read.  Our encoder's recorded video output (MyEncoderOutput.mp4), and the FFprobe output (MyEncoderOutput.csv) are available here: <a href="https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0" class="">https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0</a></div><div class=""><br class=""></div><div class="">You will notice that our command line uses h264_videotoolbox rather than libx264.  Our encoder users h264_videotoolbox also.  We have also tested our encoder when using libx264 and it shows exactly the same problem.</div><div class=""><br class=""></div><div class="">We would like to resolve this issue with our encoder, so that it will not inflate the frame size, forcing the bit rate over the target bit rate.  Ideally our encoder should perform as well as FFmpeg command line does.</div><div class=""><br class=""></div><div class="">The most relevant source files (FFMpegStreamer.m and FFMpegStreamer.h) are available here: <a href="https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0" class="">https://www.dropbox.com/sh/2g0oihshdg1z9g5/AAD7Aui_I7zWrCW6N-GrvLtGa?dl=0</a></div><div class=""><br class=""></div><div class="">Issue #2. The RTMP @setDataFrame’s onMetaData payload for our implementation differs from what FFmpeg produces from the command line. The primary concern is that the framerate is not specified.  We would like to make sure the framerate is included.  Secondarily, We would like to understand why our implementation specifies <duration> and <filesize>.  This is a live stream and those values seem invalid for a live stream.</div><div class=""><br class=""></div><div class="">Our implementation sends the following values in the onMetaData message:</div><div class=""><br class=""></div><div class=""><metadata></div><div class=""><duration>0.0</duration></div><div class=""><width>1280.0</width></div><div class=""><height>720.0</height></div><div class=""><videodatarate>1000.0</videodatarate></div><div class=""><videocodecid>7.0</videocodecid></div><div class=""><audiodatarate>96.0</audiodatarate></div><div class=""><audiosamplerate>48000.0</audiosamplerate></div><div class=""><audiosamplesize>16.0</audiosamplesize></div><div class=""><stereo>true</stereo></div><div class=""><audiocodecid>10.0</audiocodecid></div><div class=""><encoder>Lavf57.66.102</encoder></div><div class=""><filesize>0.0</filesize></div><div class=""></metadata></div><div class=""><br class=""></div><div class="">Our FFmpeg command line is set as follows, to match the values configured in my implementation as closely as possible. </div><div class=""><br class=""></div><div class="">ffmpeg -re -i TestPatternVideo.mp4 -b:v 1000k -vcodec h264_videotoolbox -ar 48000 -ab 96k -acodec aac -profile:v high -level:v 4.1 -f flv <a href="rtmp://flocasts-os1.vorigin.scaleengine.net/flocasts-os/live/ffmpeg-test1" class="">rtmp://flocasts-os1.vorigin.scaleengine.net/flocasts-os/live/ffmpeg-test1</a></div><div class=""><br class=""></div><div class="">FFmpeg sends the following values in the onMetaData message.  </div><div class=""><br class=""></div><div class=""><metadata></div><div class=""><width>1280.0</width></div><div class=""><height>720.0</height></div><div class=""><videodatarate>976.5625</videodatarate></div><div class=""><framerate>30.0</framerate></div><div class=""><videocodecid>7.0</videocodecid></div><div class=""><audiodatarate>93.75</audiodatarate></div><div class=""><audiosamplerate>48000.0</audiosamplerate></div><div class=""><audiosamplesize>16.0</audiosamplesize></div><div class=""><stereo>true</stereo></div><div class=""><audiocodecid>10.0</audiocodecid></div><div class=""><major_brand>qt</major_brand></div><div class=""><minor_version>0</minor_version></div><div class=""><compatible_brands>qt</compatible_brands></div><div class=""><encoder>Lavf57.56.101</encoder></div><div class=""><br class=""></div><div class="">We notice both the audio and video data rates are not reported exactly as they are specified in the command line.  We don’t believe this is a problem, but we’d like to understand why.  We’d also notice the Libavformat, as specified by <encoder>, is not exactly the same as in our implementation.  We would also like to know why this is.</div></div><div class=""><br class=""></div><br class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Adam Fenn</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a href="mailto:adamfenn28@gmail.com" class="">adamfenn28@gmail.com</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<br class=""></body></html>