[FFmpeg-devel] questions about multi-thread issues for ffmpeg
Ronald S. Bultje
rsbultje at gmail.com
Mon Sep 12 15:43:18 EEST 2016
On Mon, Sep 12, 2016 at 4:30 AM, qw <applemax82 at 163.com> wrote:
> hi Ronald,
> >does ffmpeg support multi-thread in this case? If not, which ffmpeg
> >> functions should be synchronized by application developer?
> >Yes, ffmpeg supports multi-threading (internally), it is tested
> >continuously and is considered very safe.
> >Can you show some code? I'm wondering if your use is unusual.
> In my side, ffmpeg 2.8.6 is used to make the simple transcoding program,
> while x264 as video encoder with 2 pass rate control algorithm.
> Because of using 2-pass rate control, AVFormatContext is created with
> setting AVFMT_NOFILE for 1st pass, which just encodes video stream. After
> encoding the total video stream, video and audio streams are encoded for
> 2nd pass. If two transocding tasks are started simultaneously, and each
> corresponds to one thread, AVFormatContext::oformat->flags is changed to
> unset AVFMT_NOFILE at the end of 1st pass encoding, i.e. flushing bufferred
> video from x264 encoder.
> If AVFMT_NOFILE is unset in AVFormatContext::oformat->flags for 1st pass,
> there is no crash issue any more.
Are these two transcoding tasks (re)using the same AVFormatContext?
More information about the ffmpeg-devel