Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (35)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (5420)

  • FFmpeg chromakey libavfilter using C-API - key/replace green with alpha transparency

    3 juin 2020, par ZeroDefect

    I'm trying to use the FFmpeg chromakey libavfilter (via the C-API using C++17) to key some green pixels in a YUVA422p image and replace them with alpha transparency.

    



    Now, I setup/initialise the graph, connect the filters, and push through a frame ; however, the output frame appears unchanged. I suspect one of my configuration parameters is incorrect, but I'm really unsure. After having read the pertinent documentation, I still don't understand the problem.

    



    I have published a (minimal) code sample in github - https://github.com/zerodefect/chromakey_test. I have tried to keep the code sample as brief as possible but it is still a bit lengthy.

    



    The code sample includes a sample image (green_screen.png) for the purposes of testing.

    



    To run the application, the following parameters are required :

    



    


    ./cb_chroma_key_test ./green_screen.png [OUTPUT_PATH]

    


    



    The application dumps out a PLANAR image at YUV422p which I then load in via rawpixels.net - a brilliant little online utility to view raw image data (packed or planar).

    



    My avfilter graph consists of :

    



    


    buffersrc -> format -> chromakey -> buffersink

    


    



    The format filter is taking the RGBA (packed) format and converting it to YUVA422 planar.

    



      

    • GCC 8.4
    • 


    • Ubuntu 18.04
    • 


    • FFmpeg 4.2
    • 


    


  • Raw audio decoding of video with Libav is chopped

    25 juin 2020, par Alphabet

    I'm currently using libav to extract the audio stream of a video into a raw PCM file.

    


    This code works fine for mp3 but when I try with a mp4 video, the raw format imported on Audacity show stranges regular descending lines between 0 and -1.

    


    Audacity Waveform

    


    Here is my implementation.

    


    #include &#xA;#include &#xA;#include &#xA;#include &#xA;&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswresample></libswresample>swresample.h>&#xA;&#xA;int decode_raw(AVFormatContext *format_ctx)&#xA;{&#xA;    AVCodec *codec = NULL;&#xA;    AVCodecContext* codec_ctx = NULL;&#xA;    AVFrame* frame = NULL;&#xA;    AVPacket packet;&#xA;    int stream_idx = av_find_best_stream(format_ctx, AVMEDIA_TYPE_AUDIO,  -1, -1, &amp;codec, 0);&#xA;    int res;&#xA;&#xA;    if (stream_idx &lt; 0) {&#xA;        printf("Could not find stream.\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    if ((codec_ctx = avcodec_alloc_context3(codec)) == NULL) {&#xA;        printf("Could not allocate codec context.\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    if (avcodec_parameters_to_context(codec_ctx, format_ctx->streams[stream_idx]->codecpar) &lt; 0) {&#xA;        printf("Could not setup codec context parameters.\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    // Explicitly request non planar data.&#xA;    codec_ctx->request_sample_fmt = av_get_packed_sample_fmt(codec_ctx->sample_fmt);&#xA;&#xA;    if (avcodec_open2(codec_ctx, codec, NULL) != 0) {&#xA;        printf("Could not open codec.\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    if ((frame = av_frame_alloc()) == NULL) {&#xA;        printf("Could not alloc frame.\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    av_init_packet(&amp;packet);&#xA;&#xA;    int fd = open("raw", O_CREAT | O_WRONLY | O_TRUNC);&#xA;&#xA;    // Decode frames.&#xA;    while ((res = av_read_frame(format_ctx, &amp;packet)) == 0) {&#xA;        // Does the packet belong to the correct stream?&#xA;        if (packet.stream_index != stream_idx) {&#xA;            av_packet_unref(&amp;packet);&#xA;            continue;&#xA;        }&#xA;&#xA;        // We have a valid packet => send it to the decoder.&#xA;        if ((res = avcodec_send_packet(codec_ctx, &amp;packet)) != 0) {&#xA;            printf("Failed to send packet: %d.\n", res);&#xA;            break;&#xA;        }&#xA;&#xA;        av_packet_unref(&amp;packet);&#xA;        res = avcodec_receive_frame(codec_ctx, frame);&#xA;&#xA;        if (res == AVERROR(EAGAIN) || res == AVERROR_EOF)&#xA;            break;&#xA;        else if (res &lt; 0) {&#xA;            printf("Failed to decode packet: %d.\n", res);&#xA;            return (1);&#xA;        }&#xA;&#xA;        write(fd, frame->extended_data[0], frame->linesize[0]);&#xA;    }&#xA;&#xA;    close(fd);&#xA;    av_frame_free(&amp;frame);&#xA;    avcodec_close(codec_ctx);&#xA;    avcodec_free_context(&amp;codec_ctx);&#xA;    return (0);&#xA;}&#xA;&#xA;int main(int argc, char **argv)&#xA;{&#xA;    AVFormatContext *av_format_ctx = NULL;&#xA;&#xA;    if (argc != 2) {&#xA;        printf("./streamer [file]\n");&#xA;        return (1);&#xA;    }&#xA;&#xA;    if (avformat_open_input(&amp;av_format_ctx, argv[1], NULL, NULL) != 0) {&#xA;        printf("Could not open input file.");&#xA;        return (1);&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(av_format_ctx, NULL) != 0) {&#xA;        printf("Could not find stream information.");&#xA;        return (1);&#xA;    }&#xA;&#xA;    decode_raw(av_format_ctx);&#xA;    avformat_close_input(&amp;av_format_ctx);&#xA;    return (0);&#xA;}&#xA;

    &#xA;

    What I tried

    &#xA;

      &#xA;
    • Check endianness and if I correctly imported the raw file in Audacity
    • &#xA;

    • Execute the corresponding ffmpeg command ffmpeg -i video.mp4 -f f32le output.raw (my code output AV_SAMPLE_FMT_FLT) to compare both files.
    • &#xA;

    &#xA;

    I hexdumped both files and found this.

    &#xA;

    // 96 1f 03 3f - 22 03 0c 3f&#xA;// Doesn&#x27;t exist in the output of my program?&#xA;&#xA;5581a0  7c ad 6f bc 96 1f 03 3f 4f 01 25 3e 22 03 0c 3f  |.o....?O.%>"..?   // ffmpeg&#xA;5580d0  7c ad 6f bc 4f 01 25 3e 3a d2 89 3e 7c d7 9a 3e  |.o.O.%>:..>|..>   // my implementation&#xA;

    &#xA;


    &#xA;

    Edit #1

    &#xA;

    After an endless succession of disappointing experiences, AAC audio streams appear to be corrupted after decoding. However, the raw PCM output from ffmpeg works well for MP4.

    &#xA;

    I tried to resample the audio frames with swr_convert but it is too poorly documented and I turned into a lot of issues.

    &#xA;

  • Grab audio samples with ffmpeg and C, error with official example code

    31 août 2020, par nji9

    For dev with mingw-w64 I'm using ffmpeg v. 4.3.1. and also the latest Git version of ffmpeg (Zeranoe's Windows 64 builds).

    &#xA;

    I get "strange" problems when running the official example code for decoding audio

    &#xA;

    https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/decode_audio.c

    &#xA;

    MP3DirectCut(Lib-bass).mp3

    &#xA;

    http://www.mediafire.com/file/ozmjjcpwyhhdnr7/MP3DirectCut(Lib-bass).mp3/file

    &#xA;

    Generates pcm, but outputs :

    &#xA;

    "Warning: the sample format the decoder produced is planar (s16p).&#xA;This example will output the first channel only."&#xA;

    &#xA;

    But the output pcm has both channels !??

    &#xA;

    When recoding the above mp3 to wav with ffmpeg (4.1.4, no error message)

    &#xA;

    http://www.mediafire.com/file/gcq7ryg43pd57q5/ffmpeg4.1.4.wav/file

    &#xA;

    and also when recoding the latter to mp3 again

    &#xA;

    http://www.mediafire.com/file/ij865dkrprn2lta/ffmpeg4.1.4_recode.mp3/file

    &#xA;

    the example code breaks and produces these error messages :

    &#xA;

    avcodec_send_packet ()&#xA;from within:&#xA;"[mp2 @ <someaddress>] Header missing"&#xA;and returns error code -1094995529&#xA;(= "Invalid data found when processing input")&#xA;</someaddress>

    &#xA;

    It produces that error message for literally all other formats&#xA;I tried, and also when written with another editor (Audition 3.0).&#xA;But all the files play and show fine on all programs I have.

    &#xA;

    I'm at a lost at this point.&#xA;What is going on and wrong here ?

    &#xA;