Skip to content

Commit

Permalink
Reduce the amount of ffmpeg log messages while generating thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavenVolkoff committed Apr 5, 2024
1 parent efe2b47 commit 7cd5246
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions crates/ffmpeg/src/movie_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ use crate::{

use ffmpeg_sys_next::{
av_buffersink_get_frame, av_buffersrc_write_frame, av_dict_get, av_display_rotation_get,
av_frame_alloc, av_frame_free, av_packet_alloc, av_packet_free, av_packet_unref, av_read_frame,
av_seek_frame, av_stream_get_side_data, avcodec_alloc_context3, avcodec_find_decoder,
avcodec_flush_buffers, avcodec_free_context, avcodec_open2, avcodec_parameters_to_context,
avcodec_receive_frame, avcodec_send_packet, avfilter_get_by_name, avfilter_graph_alloc,
avfilter_graph_config, avfilter_graph_create_filter, avfilter_graph_free, avfilter_link,
avformat_close_input, avformat_find_stream_info, avformat_open_input, AVCodec, AVCodecContext,
AVCodecID, AVFilterContext, AVFilterGraph, AVFormatContext, AVFrame, AVMediaType, AVPacket,
av_frame_alloc, av_frame_free, av_log_set_level, av_packet_alloc, av_packet_free,
av_packet_unref, av_read_frame, av_seek_frame, av_stream_get_side_data, avcodec_alloc_context3,
avcodec_find_decoder, avcodec_flush_buffers, avcodec_free_context, avcodec_open2,
avcodec_parameters_to_context, avcodec_receive_frame, avcodec_send_packet,
avfilter_get_by_name, avfilter_graph_alloc, avfilter_graph_config,
avfilter_graph_create_filter, avfilter_graph_free, avfilter_link, avformat_close_input,
avformat_find_stream_info, avformat_open_input, AVCodec, AVCodecContext, AVCodecID,
AVFilterContext, AVFilterGraph, AVFormatContext, AVFrame, AVMediaType, AVPacket,
AVPacketSideDataType, AVRational, AVStream, AVERROR, AVERROR_EOF, AVPROBE_SCORE_MAX,
AV_DICT_IGNORE_SUFFIX, AV_TIME_BASE, EAGAIN,
AV_DICT_IGNORE_SUFFIX, AV_LOG_FATAL, AV_TIME_BASE, EAGAIN,
};
use std::{
ffi::{CStr, CString},
Expand Down Expand Up @@ -77,6 +78,8 @@ impl MovieDecoder {

unsafe {
let input_file_cstring = from_path(input_file)?;
// Reduce the amount of logs generated by FFmpeg
av_log_set_level(AV_LOG_FATAL);
match avformat_open_input(
&mut decoder.format_context,
input_file_cstring.as_ptr(),
Expand Down

0 comments on commit 7cd5246

Please sign in to comment.