Closed GoogleCodeExporter closed 9 years ago
I'm not a ffmpeg developer; what would be the equivalent way of setting
AVFormatCtx->max_analyze_duration to 0 inside the ffmpegthumbnailer's
MovieDecoder::initialize() function?
Original comment by oneorj...@gmail.com
on 2 Sep 2013 at 5:22
try adding:
m_pFormatContext->max_analyze_duration = 0;
Original comment by dirk.vdb
on 10 Sep 2013 at 9:01
Found a workaround to this problem: the call to
VideoThumbnailer::generateThumbnail() must be done inside a try/catch block AND
covered by a mutex:
std::vector<uint8_t> buffer;
mutex.lock();
try {
thumbnailer.generateThumbnail(item.toStdString(), Jpeg, buffer);
}
catch (std::exception& e) {
qDebug() << "WARNING" << e.what();
}
mutex.unlock();
So this issue is happening for 2 reasons:
1) Insufficient thread protection around the thread-unsafe functions of ffmpeg:
avformat_open_input() and avformat_find_stream_info(), which in turn call
avcodec_open() and avcodec_close(). I'm assuming this should be thread-safe
because generating thumbnails from a set of files is the kind of task which
naturally asks for parallelization, thus being (always IMHO) part of the
ffmpegthumbnailer scope as a library.
2) Insufficient protection in VideoThumbnailer::generateThumbnail() against
exceptions thrown from the constructor of MovieDecoder (which in turn calls
MovieDecoder::initialize() and may throw a couple of unmanaged 'logic_error'
exceptions).
Original comment by oneorj...@gmail.com
on 13 Sep 2013 at 11:41
1) I don't fully agree with your reasoning that ffmpegthumbailer should be
thread safe.
If you want to create thumbnails in parrallel, create multiple instances of the
VideoThumbnailer class.
2) The generateThumbnail method does not catch these errors because then the
thumbnail creation would silently fail. The caller should call the method in a
try catch block.
Original comment by dirk.vdb
on 3 Oct 2013 at 2:44
Original comment by dirk.vdb
on 1 Mar 2014 at 8:59
Original issue reported on code.google.com by
oneorj...@gmail.com
on 2 Sep 2013 at 5:20