We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was trying to convert a sticker in webm format to gif format, but some problems occurred.
An error occurs when running the following code:
use ac_ffmpeg::format::demuxer::{Demuxer, InputFormat}; use ac_ffmpeg::format::io::IO; use ac_ffmpeg::format::muxer::{Muxer, OutputFormat}; use anyhow::Context; pub(crate) fn convert_webm_to_gif(input_buffer: Vec<u8>) -> anyhow::Result<Vec<u8>> { let ictx = IO::from_read_stream(input_buffer.as_slice()); let mut demuxer = Demuxer::builder() .input_format(Some( InputFormat::find_by_name("webm").context("WebM format not found")?, )) .build(ictx)? .find_stream_info(None) .map_err(|err| err.1)?; let video_stream_index = demuxer .streams() .iter() .position(|stream| { stream .codec_parameters() .as_video_codec_parameters() .is_some() }) .ok_or(anyhow::anyhow!("No video stream found"))?; let mut output_buffer = Vec::new(); let mut muxer = { let mut builder = Muxer::builder(); builder .add_stream(&demuxer.streams()[video_stream_index].codec_parameters()) .map_err(|err| anyhow::anyhow!("Failed to add stream to muxer: {}", err))?; builder .build( IO::from_write_stream(&mut output_buffer), OutputFormat::find_by_name("gif").context("GIF format not found")?, ) .map_err(|err| anyhow::anyhow!("Failed to create muxer: {}", err))? }; while let Some(packet) = demuxer.take()? { if packet.stream_index() == video_stream_index { muxer.push(packet.with_stream_index(0))?; } } // flush the muxer muxer.flush()?; muxer.close()?; Ok(output_buffer) }
Error: [gif @ 0x128f08300] GIF muxer supports only a single video GIF stream.
[gif @ 0x128f08300] GIF muxer supports only a single video GIF stream.
The text was updated successfully, but these errors were encountered:
I'm a noob developer, so please excuse me if I have some stupid questions. 😢
Sorry, something went wrong.
No branches or pull requests
I was trying to convert a sticker in webm format to gif format, but some problems occurred.
An error occurs when running the following code:
Error:
[gif @ 0x128f08300] GIF muxer supports only a single video GIF stream.
The text was updated successfully, but these errors were encountered: