Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How to extract the 1st frame and restore as an image with ffmpeg ? [closed]

    14 février, par lex

    Anyone knows the trick?

    And how to install ffmpeg ? yum install mpeg only returns this:

    ======================================================================================== Matched: mpeg ========================================================================================
    libiec61883.i386 : Streaming library for IEEE1394
    libiec61883.x86_64 : Streaming library for IEEE1394
    qffmpeg-devel.i386 : Development package for qffmpeg
    qffmpeg-devel.x86_64 : Development package for qffmpeg
    qffmpeg-libs.i386 : Libraries for qffmpeg
    qffmpeg-libs.x86_64 : Libraries for qffmpeg
    
  • Using swr_convert to resample audio frames resulted in audio with significant noise [closed]

    14 février, par Bruce Hu

    I attempted to use swr_convert to resample audio frames from 44100 Hz to 16000 Hz, processing the frames one by one for testing purposes. However, the resulting audio appears to be mixed with noise.

    The following code shows how I resample a single audio frame:

    
       AVFrame* output_frame = av_frame_alloc();
        if (!output_frame) {
            throw std::runtime_error("Failed to allocate output AVFrame");
        }
    
        AVRational output_time_base = {1, output_sample_rate};
        
        SwrContext* swr_ctx = swr_alloc();
        if (!swr_ctx) {
            av_frame_free(&output_frame);
            throw std::runtime_error("Failed to allocate SwrContext");
        }
    
        av_opt_set_int(swr_ctx, "in_sample_fmt", aframe->format, 0);
        av_opt_set_int(swr_ctx, "out_sample_fmt", output_format, 0);
        av_opt_set_int(swr_ctx, "in_channel_layout", aframe->channel_layout, 0);
        av_opt_set_int(swr_ctx, "out_channel_layout", output_channel_layout, 0);
        av_opt_set_int(swr_ctx, "in_sample_rate", aframe->sample_rate, 0);
        av_opt_set_int(swr_ctx, "out_sample_rate", output_sample_rate, 0);
    
        if (swr_init(swr_ctx) < 0) {
            swr_free(&swr_ctx);
            av_frame_free(&output_frame);
            throw std::runtime_error("Failed to initialize SwrContext");
        }
    
        output_frame->format = output_format;
        output_frame->channel_layout = output_channel_layout;
        output_frame->sample_rate = output_sample_rate;
    
        int64_t delay = swr_get_delay(swr_ctx, aframe->sample_rate);
        output_frame->nb_samples = av_rescale_rnd(
            delay + aframe->nb_samples, output_sample_rate, aframe->sample_rate, AV_ROUND_UP);
            
        output_frame->nb_samples = av_rescale_rnd(
            aframe->nb_samples, output_sample_rate, aframe->sample_rate, AV_ROUND_UP);
    
        if (av_frame_get_buffer(output_frame, 0) < 0) {
            swr_free(&swr_ctx);
            av_frame_free(&output_frame);
            throw std::runtime_error("Failed to allocate buffer for output AVFrame");
        }
    
        int ret = swr_convert(swr_ctx,
                              output_frame->data, output_frame->nb_samples,
                              (const uint8_t**)aframe->data, aframe->nb_samples);
    
        if (ret < 0) {
            swr_free(&swr_ctx);
            av_frame_free(&output_frame);
            throw std::runtime_error("Failed to resample audio data");
        }
    
        if (aframe->pts != AV_NOPTS_VALUE) {
            output_frame->pts = av_rescale_q(aframe->pts, {1, aframe->sample_rate}, output_time_base);
        } else {
            output_frame->pts = AV_NOPTS_VALUE;
        }
    
  • What tool can I use to analyze audio and clip webm files ? [closed]

    14 février, par Phillip Feldman

    I have a bunch of 2-3 hour long podcast webms from Youtube. I want to extract the audio from them, and programmatically analyze things like volume, or who's speaking. I then want to use my analysis to clip the original webms. What tools can I use to do this, and is size of the audio files something that I need to consider? I know python and have used ffmpeg.

  • Eleven Labs API not working, is ffmpeg not installed properly ?

    13 février, par Daniel Masso Pardo
    Traceback (most recent call last):
      File "C:\Users\danim\OneDrive\Desktop\programming\APItests.py", line 9, in 
        play(audio)
      File "C:\Users\danim\PycharmProjects\EXAM\venv\lib\site-packages\elevenlabs\utils.py", line 25, in play
        raise ValueError(message)
    ValueError: ffplay from ffmpeg not found, necessary to play audio. On mac you can install it with 'brew install ffmpeg'. On linux and windows you can install it from https://ffmpeg.org/
    

    I keep getting this error, and yes, I've gone to the web site and installed, made a path "C:\Users(my name)\ffmpeg\bin" and exported it there, but it doesn't work.

    I'm expecting to get the result as audio from the free Eleven Labs API, but I keep getting these issues.

  • ffmpeg mp4 to hls transcode fails on Azure Windows Server Image [closed]

    13 février, par James Weatherhead

    I am having an issue with transcoding an mp4 (any mp4) to hls. If I run the command below on my Windows 11 machine it works fine. If I run it on a clean Windows 11 VM, it works fine. If I run it on a clean Windows 2022 Server VM it works fine. If I create a Windows 2022 server image in Azure and run it... it fails (see error below)

    I feel like something that FFMPEG needs is missing from the default server image in Azure. Has anyone experienced this issue and found a way to solve it?

    The command I am using:

    ffmpeg.exe -i LowPriVMs-1.mp4 -filter_complex "[0:v]split=1[v1]; [v1]scale=w=1920:h=1080[v1out]; " -map "[v1out]" -c:v:0 mpeg4 -b:v:0 5000k -maxrate:v:0 5350k -bufsize:v:0 7500k -map a:0 -c:a aac -b:a:0 192k -ac 2 -f hls -hls_time 10 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename stream_%v/data%03d.ts -master_pl_name master.m3u8 -var_stream_map "v:0,a:0" stream_%v/playlist.m3u8

    The error returned by FFMPEG is:

    [out#0/hls @ 00000204c6aded40] Could not write header (incorrect codec parameters ?): Invalid argument

    Has anyone else encountered this and found a solution? I wondered if it is required to add a Feature Pack or some such dependency to Windows?

    Thanks James