serenity-rs / songbird

An async Rust library for the Discord voice API
ISC License
391 stars 111 forks source link

add custom arg for ffmpeg #201

Closed thedtvn closed 10 months ago

thedtvn commented 11 months ago

add custom arg for ffmpeg for playing steam data that not auto stop audio or make like -reconnect

Skarlett commented 11 months ago

Assuming you're referring to the current branch. Perhaps this is the piece of code you're looking for?

You can prepend arguments to _ytdl via pre_args

thedtvn commented 11 months ago

@Skarlett i like to play audio raw and pass args to ffmpeg to that go play some live audio and make it none stop before audio end

thedtvn commented 11 months ago

like

// Extra command line arguments to pass to ffmpeg before the -i flag.
let before_options = ["-reconnect", "1", "-reconnect_streamed", "1", "-reconnect_delay_max", "10"];
//  Extra command line arguments to pass to ffmpeg after the -i flag.
let after_options = ["-vn"];
let data = Restartable::ffmpeg("<audio url>", before_options, after_options , false).await.unwrap();
thedtvn commented 11 months ago

i see songbird::input::ffmpeg_optioned that fix this sory

thedtvn commented 11 months ago

i use songbird::input::ffmpeg_optioned

ffmpeg_optioned("<audio url>", &[], &[
     "-f",
     "s16le",
     "-ac",
     stereo_val,
     "-ar",
     "48000",
     "-acodec",
     "pcm_s16le",
     "-",
 ])

and bot show is Audio Detected but is has no audio