You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use symphonia::core::formats::{FormatOptions};
use symphonia::core::io::MediaSourceStream;
use symphonia::core::meta::MetadataOptions;
use symphonia::core::probe::Hint;
use std::path::Path;
use symphonia::core::codecs::{CODEC_TYPE_NULL, DecoderOptions};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// let input_path = Path::new("video.webm");
let input_path = Path::new("file_example_WEBM_480_900KB.webm");
let src = std::fs::File::open(&input_path).expect("failed to open media");
let mss = MediaSourceStream::new(Box::new(src), Default::default());
let mut hint = Hint::new();
hint.with_extension("webm");
// Use the default options for metadata and format readers.
let meta_opts: MetadataOptions = Default::default();
let fmt_opts: FormatOptions = Default::default();
// Probe the media source.
let probed = symphonia::default::get_probe().format(&hint, mss, &fmt_opts, &meta_opts)
.expect("unsupported format");
let format = probed.format;
// Print codec information
for track in format.tracks() {
println!("Track ID: {}", track.id);
println!("Codec: {:02}", track.codec_params.codec);
println!("Channels: {:?}", track.codec_params.channels);
println!("Sample Rate: {:?}", track.codec_params.sample_rate);
}
// Find the first audio track with a known (decodeable) codec.
let track = format.tracks()
.iter()
.find(|t| t.codec_params.codec != CODEC_TYPE_NULL)
.expect("no supported audio tracks");
let dec_opts: DecoderOptions = Default::default();
// Create a decoder for the track.
let _decoder = symphonia::default::get_codecs().make(&track.codec_params, &dec_opts)
.expect("unsupported codec");
println!("Conversion completed successfully!");
Ok(())
}
if i understand this issue correctly, it is a duplicate of #8.
thread 'main' panicked at src/bin/convert.rs:46:10: let _decoder = symphonia::default::get_codecs().make(&track.codec_params, &dec_opts) .expect("unsupported codec");
if the error comes from the same code as provided, this is the line it panics on, which is expected as you are trying to make a decoder for opus in symphonia, which is a codec which is not yet implemented and explicitly expect it.
but on the orher hand I see in both cases 0x0 for video stream but
symphonia currently does not handle any video stream, only audio.
so it is issue of opus or vp8 and vp9?
TL;DR: the issue is opus and you trying to make a decoder for it
Steps to reproduce:
1 Lets download files:
Lets inspect them by ffmpeg -i
Working file
Not working file
Most important probably are lines:
working:
not working
My code:
for working file it will print result
but for not working
I found that in working examle we using vorbis
pub const CODEC_TYPE_VORBIS: CodecType = CodecType(0x1000);
but for not working opus
pub const CODEC_TYPE_OPUS: CodecType = CodecType(0x1005);
and it can be potentially connected with issue #8
but on the orher hand I see in both cases 0x0 for video stream but
vorbis and opus are audio streams recognized by ffmpeg
so it is issue of opus or vp8 and vp9?
The text was updated successfully, but these errors were encountered: