

TwitchTranscoder is our in-house software developed to address the technical issues discussed earlier. Our key insight here is that while multithreaded functionality does exist for this tool, it does not match the exact needs of Twitch’s streaming service and cannot be used as we would like.

FFmpeg documentation also suggests that in our use case, it may make more sense to launch multiple FFmpeg instances in parallel. We can conclude that FFmpeg may be suboptimal in producing results using only a single thread since the 1-in-N-out streaming model of transcoding is most valuable to us. Transcode_step() wraps the main pipeline and orchestrates file I/O, filtering, decoding and encoding amongst many other immediate steps.ĭuring the initial setup phase, init_input_threads() (line 4020) is called, and based on the number of input files, a number of new threads may be spawned to process the input.īy following this pipeline, we can see redundancy in how these frames are handled sequentially through the context of a single thread. In the top-level ffmpeg.c file, the transcode() function (line 4544) loops and repeatedly calls transcode_step() (line 4478) until its inputs are completely processed, or until the user interrupts the execution.
#Best twitch streaming software 2017 code
source code in order to understand its threading model and transcoding pipeline. How does FFmpeg programmatically deal with instances where a single input stream is required to generate multiple transcoded and/or transmuxed outputs? We went directly into the latest FFmpeg Release 3.3. Why doesn’t it handle the technical issues discussed earlier? Make sure you read Part 1 first.įFmpeg’s 1-In-N-Out Pipeline. Note: This is the second part of a 2-part series. John Nichols, Principal Software Engineer at Xilinx, for their information on FFmpeg and reviewing this article. By: Jeff Gong, Software Engineer, Sahil Dhanju, Software Engineer InternĬhih-Chiang Lu, Senior Software Engineer, Yueshi Shen, Principal Research Engineer, thanks go to: Christopher Kennedy, Staff Video Engineer at Crunchyroll/Ellation
