Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (54)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (3886)

  • Resampling audio with FFMPEG LibAV

    22 septembre 2020, par FennecFix

    Well, since FFMPEG documentation and code examples are absolute garbage, I guess my only choise is to go here and aks.

    


    So what I'm trying to do is simply record audio from microphione and write it to the file. So I initialize my input and out formats, I get an audio packet decode it, resample, encode and write. But everytime I try to play and audio there's only a stub of data. It seems like for some reason it writes only a start packet. Which is still very strange and let me explain why :

    


    if((response = swr_config_frame(resampleContext, audioOutputFrame, frame) < 0)) qDebug() << "can't configure frame!" <<  av_make_error(response);

if((response = swr_convert_frame(resampleContext, audioOutputFrame, frame) < 0)) qDebug() << "can't resample frame!" <<  av_make_error(response);


    


    Here's the code I'm using to resample. My frame has data but swr_convert_frame writes empty data to audioOutputFrame

    


    How do I fix that ? FFMPEG literally driving me crazy.

    


    Here's the full code of my class

    


    VideoReader.h

    


    #ifndef VIDEOREADER_H&#xA;#define VIDEOREADER_H&#xA;&#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;#include "libavutil/audio_fifo.h"&#xA;#include "libavformat/avio.h"&#xA;#include "libswresample/swresample.h"&#xA;#include &#xA;}&#xA;&#xA;#include <qstring>&#xA;#include <qelapsedtimer>&#xA;&#xA;class VideoReader&#xA;{&#xA;public:&#xA;    VideoReader();&#xA;&#xA;    bool open(const char* filename);&#xA;    bool fillFrame();&#xA;    bool readFrame(uint8_t *&amp;frameData);&#xA;    void close();&#xA;&#xA;    int width, height;&#xA;&#xA;private:&#xA;    bool configInput();&#xA;    bool configOutput(const char *filename);&#xA;    bool configResampler();&#xA;&#xA;    bool encode(AVFrame *frame, AVCodecContext *encoderContext, AVPacket *outputPacket, int streamIndex, QString type);&#xA;&#xA;    int audioStreamIndex = -1;&#xA;    int videoStreamIndex = -1;&#xA;&#xA;    int64_t videoStartPts = 0;&#xA;    int64_t audioStartPts = 0;&#xA;&#xA;    AVFormatContext* inputFormatContext = nullptr;&#xA;    AVFormatContext* outputFormatContext = nullptr;&#xA;&#xA;    AVCodecContext* videoDecoderContext = nullptr;&#xA;    AVCodecContext* videoEncoderContext = nullptr;&#xA;&#xA;    AVCodecContext* audioDecoderContext = nullptr;&#xA;    AVCodecContext* audioEncoderContext = nullptr;&#xA;&#xA;    AVFrame* videoInputFrame = nullptr;&#xA;    AVFrame* audioInputFrame = nullptr;&#xA;&#xA;    AVFrame* videoOutputFrame = nullptr;&#xA;    AVFrame* audioOutputFrame = nullptr;&#xA;&#xA;    AVPacket* inputPacket = nullptr;&#xA;&#xA;    AVPacket* videoOutputPacket = nullptr;&#xA;    AVPacket* audioOutputPacket = nullptr;&#xA;&#xA;    SwsContext* innerScaleContext = nullptr;&#xA;    SwsContext* outerScaleContext = nullptr;&#xA;&#xA;    SwrContext *resampleContext = nullptr;&#xA;};&#xA;&#xA;#endif // VIDEOREADER_H&#xA;</qelapsedtimer></qstring>

    &#xA;

    VideoReader.cpp

    &#xA;

    #include "VideoReader.h"&#xA;&#xA;#include <qdebug>&#xA;&#xA;static const char* av_make_error(int errnum)&#xA;{&#xA;    static char str[AV_ERROR_MAX_STRING_SIZE];&#xA;    memset(str, 0, sizeof(str));&#xA;    return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);&#xA;}&#xA;&#xA;VideoReader::VideoReader()&#xA;{&#xA;&#xA;}&#xA;&#xA;bool VideoReader::open(const char *filename)&#xA;{&#xA;    if(!configInput()) return false;&#xA;    if(!configOutput(filename)) return false;&#xA;    if(!configResampler()) return false;&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoReader::fillFrame()&#xA;{&#xA;    auto convertToYUV = [=](AVFrame* frame)&#xA;    {&#xA;        int response = 0;&#xA;&#xA;        if((response = sws_scale(outerScaleContext, frame->data, frame->linesize, 0, videoEncoderContext->height, videoOutputFrame->data, videoOutputFrame->linesize)) &lt; 0) qDebug() &lt;&lt; "can&#x27;t rescale" &lt;&lt; av_make_error(response);&#xA;    };&#xA;&#xA;    auto convertAudio = [this](AVFrame* frame)&#xA;    {&#xA;        int response = 0;&#xA;&#xA;        auto&amp; out = audioOutputFrame;&#xA;        qDebug() &lt;&lt; out->linesize[0] &lt;&lt; out->nb_samples;&#xA;        if((response = swr_convert_frame(resampleContext, audioOutputFrame, frame)) &lt; 0) qDebug() &lt;&lt; "can&#x27;t resample frame!" &lt;&lt; av_make_error(response);&#xA;        qDebug() &lt;&lt; "poop";&#xA;    };&#xA;&#xA;    auto decodeEncode = [=](AVPacket* inputPacket, AVFrame* inputFrame, AVCodecContext* decoderContext,&#xA;                            AVPacket* outputPacket, AVFrame* outputFrame, AVCodecContext* encoderContext,&#xA;                            std::function<void> convertFunc,&#xA;                            int streamIndex, int64_t startPts, QString type)&#xA;    {&#xA;        int response = avcodec_send_packet(decoderContext, inputPacket);&#xA;        if(response &lt; 0) { qDebug() &lt;&lt; "failed to send" &lt;&lt; type &lt;&lt; "packet!" &lt;&lt;  av_make_error(response); return false; }&#xA;&#xA;        response = avcodec_receive_frame(decoderContext, inputFrame);&#xA;        if(response == AVERROR(EAGAIN) || response == AVERROR_EOF) { av_packet_unref(inputPacket); return false; }&#xA;        else if (response &lt; 0) { qDebug() &lt;&lt; "failed to decode" &lt;&lt; type &lt;&lt; "frame!" &lt;&lt; response &lt;&lt; av_make_error(response); return false; }&#xA;&#xA;        if(encoderContext)&#xA;        {&#xA;            outputFrame->pts = inputPacket->pts - startPts;&#xA;&#xA;            convertFunc(inputFrame);&#xA;            if(!encode(outputFrame, encoderContext, outputPacket, streamIndex, type)) return false;&#xA;        }&#xA;&#xA;        av_packet_unref(inputPacket);&#xA;&#xA;        return true;&#xA;    };&#xA;&#xA;    while(av_read_frame(inputFormatContext, inputPacket) >= 0) //actually read packet&#xA;    {&#xA;        if(inputPacket->stream_index == videoStreamIndex)&#xA;        {&#xA;            if(!videoStartPts) videoStartPts = inputPacket->pts;&#xA;            if(decodeEncode(inputPacket, videoInputFrame, videoDecoderContext, videoOutputPacket, videoOutputFrame, videoEncoderContext, convertToYUV, videoStreamIndex, videoStartPts, "video")) break;&#xA;        }&#xA;        else if(inputPacket->stream_index == audioStreamIndex)&#xA;        {&#xA;            if(!audioStartPts) audioStartPts = inputPacket->pts;&#xA;            if(decodeEncode(inputPacket, audioInputFrame, audioDecoderContext, audioOutputPacket, audioOutputFrame, audioEncoderContext, convertAudio, audioStreamIndex, audioStartPts, "audio")) break;&#xA;        }&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoReader::readFrame(uint8_t *&amp;frameData)&#xA;{&#xA;    if(!fillFrame()) { qDebug() &lt;&lt; "readFrame method failed!"; return false; };&#xA;&#xA;    const int bytesPerPixel = 4;&#xA;&#xA;    uint8_t* destination[bytesPerPixel] = {frameData, NULL, NULL, NULL};&#xA;    int destinationLinesize[bytesPerPixel] = { videoInputFrame->width * bytesPerPixel,  0, 0, 0};&#xA;&#xA;    sws_scale(innerScaleContext, videoInputFrame->data, videoInputFrame->linesize, 0, videoInputFrame->height, destination, destinationLinesize);&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;void VideoReader::close()&#xA;{&#xA;    encode(NULL, videoEncoderContext, videoOutputPacket, videoStreamIndex, "video");&#xA;    encode(NULL, audioEncoderContext, audioOutputPacket, audioStreamIndex, "audio");&#xA;&#xA;    if(av_write_trailer(outputFormatContext) &lt; 0) { qDebug() &lt;&lt; "failed to write trailer"; };&#xA;&#xA;    avformat_close_input(&amp;outputFormatContext);&#xA;    avformat_free_context(outputFormatContext);&#xA;    avformat_close_input(&amp;inputFormatContext);&#xA;    avformat_free_context(inputFormatContext);&#xA;&#xA;    av_frame_free(&amp;videoInputFrame);&#xA;    av_frame_free(&amp;audioInputFrame);&#xA;&#xA;    av_frame_free(&amp;videoOutputFrame);&#xA;    av_frame_free(&amp;audioOutputFrame);&#xA;&#xA;    av_packet_free(&amp;inputPacket);&#xA;&#xA;    av_packet_free(&amp;videoOutputPacket);&#xA;    av_packet_free(&amp;audioOutputPacket);&#xA;&#xA;    avcodec_free_context(&amp;videoDecoderContext);&#xA;    avcodec_free_context(&amp;videoEncoderContext);&#xA;&#xA;    avcodec_free_context(&amp;audioDecoderContext);&#xA;    avcodec_free_context(&amp;audioEncoderContext);&#xA;&#xA;    sws_freeContext(innerScaleContext);&#xA;    sws_freeContext(outerScaleContext);&#xA;&#xA;    swr_free(&amp;resampleContext);&#xA;}&#xA;&#xA;bool VideoReader::configInput()&#xA;{&#xA;    avdevice_register_all();&#xA;&#xA;    inputFormatContext = avformat_alloc_context();&#xA;&#xA;    if(!inputFormatContext) { qDebug() &lt;&lt; "can&#x27;t create context!"; return false; }&#xA;&#xA;    const char* inputFormatName = "dshow";/*"gdigrab"*/&#xA;    AVInputFormat* inputFormat = av_find_input_format(inputFormatName);&#xA;&#xA;    if(!inputFormat){ qDebug() &lt;&lt; "Can&#x27;t find" &lt;&lt; inputFormatName; return false; }&#xA;&#xA;    AVDictionary* options = NULL;&#xA;    av_dict_set(&amp;options, "framerate", "30", 0);&#xA;    av_dict_set(&amp;options, "video_size", "1920x1080", 0);&#xA;&#xA;    if(avformat_open_input(&amp;inputFormatContext, "video=HD USB Camera:audio=Microphone (High Definition Audio Device)" /*"desktop"*/, inputFormat, &amp;options) != 0) { qDebug() &lt;&lt; "can&#x27;t open video file!"; return false; }&#xA;&#xA;    AVCodecParameters* videoCodecParams = nullptr;&#xA;    AVCodecParameters* audioCodecParams = nullptr;&#xA;    AVCodec* videoDecoder = nullptr;&#xA;    AVCodec* audioDecoder = nullptr;&#xA;&#xA;    for (uint i = 0; i &lt; inputFormatContext->nb_streams; &#x2B;&#x2B;i)&#xA;    {&#xA;        auto stream = inputFormatContext->streams[i];&#xA;        auto codecParams = stream->codecpar;&#xA;&#xA;        if(codecParams->codec_type == AVMEDIA_TYPE_AUDIO) { audioStreamIndex = i; audioDecoder = avcodec_find_decoder(codecParams->codec_id); audioCodecParams = codecParams; }&#xA;        if(codecParams->codec_type == AVMEDIA_TYPE_VIDEO) { videoStreamIndex = i; videoDecoder = avcodec_find_decoder(codecParams->codec_id); videoCodecParams = codecParams; }&#xA;&#xA;        if(audioStreamIndex != -1 &amp;&amp; videoStreamIndex != -1) break;&#xA;    }&#xA;&#xA;    if(audioStreamIndex == -1) { qDebug() &lt;&lt; "failed to find audio stream inside file"; return false; }&#xA;    if(videoStreamIndex == -1) { qDebug() &lt;&lt; "failed to find video stream inside file"; return false; }&#xA;&#xA;    auto configureCodecContext = [=](AVCodecContext*&amp; context, AVCodec* decoder, AVCodecParameters* params, AVFrame*&amp; frame, QString type)&#xA;    {&#xA;        context = avcodec_alloc_context3(decoder);&#xA;        if(!context) { qDebug() &lt;&lt; "failed to create" &lt;&lt; type &lt;&lt; "decoder context!"; return false; }&#xA;&#xA;        if(avcodec_parameters_to_context(context, params) &lt; 0) { qDebug() &lt;&lt; "can&#x27;t initialize input" &lt;&lt; type &lt;&lt; "decoder context"; return false; }&#xA;&#xA;        if(avcodec_open2(context, decoder, NULL) &lt; 0) { qDebug() &lt;&lt; "can&#x27;t open" &lt;&lt; type &lt;&lt; "decoder"; return false; }&#xA;&#xA;        frame = av_frame_alloc();&#xA;        if(!frame) { qDebug() &lt;&lt; "can&#x27;t allocate" &lt;&lt; type &lt;&lt; "frame"; return false; }&#xA;&#xA;        return true;&#xA;    };&#xA;&#xA;    if(!configureCodecContext(videoDecoderContext, videoDecoder, videoCodecParams, videoInputFrame, "video")) return false;&#xA;    if(!configureCodecContext(audioDecoderContext, audioDecoder, audioCodecParams, audioInputFrame, "audio")) return false;&#xA;&#xA;    audioDecoderContext->channel_layout = AV_CH_LAYOUT_STEREO;&#xA;    audioInputFrame->channel_layout = audioDecoderContext->channel_layout;&#xA;&#xA;    inputPacket = av_packet_alloc();&#xA;    if(!inputPacket) { qDebug() &lt;&lt; "can&#x27;t allocate input packet!";  return false; }&#xA;&#xA;    //first frame, needed fo initialization&#xA;    if(!fillFrame()) { qDebug() &lt;&lt; "Failed to fill frame on init!"; return false; };&#xA;&#xA;    width = videoDecoderContext->width;&#xA;    height = videoDecoderContext->height;&#xA;&#xA;    innerScaleContext = sws_getContext(width, height, videoDecoderContext->pix_fmt,&#xA;                                       width, height, AV_PIX_FMT_RGB0,&#xA;                                       SWS_FAST_BILINEAR,&#xA;                                       NULL,&#xA;                                       NULL,&#xA;                                       NULL);&#xA;&#xA;    outerScaleContext = sws_getContext(width, height, videoDecoderContext->pix_fmt,&#xA;                                       width, height, AV_PIX_FMT_YUV420P,&#xA;                                       SWS_FAST_BILINEAR,&#xA;                                       NULL,&#xA;                                       NULL,&#xA;                                       NULL);&#xA;&#xA;&#xA;    if(!innerScaleContext) { qDebug() &lt;&lt; "failed to initialize scaler context"; return false; }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoReader::configOutput(const char *filename)&#xA;{&#xA;    avformat_alloc_output_context2(&amp;outputFormatContext, NULL, NULL, filename);&#xA;    if(!outputFormatContext) { qDebug() &lt;&lt; "failed to create output context"; return false; }&#xA;&#xA;    AVOutputFormat* outputFormat = outputFormatContext->oformat;&#xA;&#xA;    auto prepareOutputContext = [=](AVCodecContext*&amp; encoderContext,&#xA;                                    std::function<void> configureContextFunc,&#xA;                                    std::function<void> configureFrameFunc,&#xA;                                    AVCodecID codecId, AVFrame*&amp; frame, AVPacket*&amp; packet, QString type)&#xA;    {&#xA;        auto stream = avformat_new_stream(outputFormatContext, NULL);&#xA;        if(!stream) { qDebug() &lt;&lt; "failed to allocate output" &lt;&lt; type &lt;&lt; "stream"; return false; }&#xA;&#xA;        AVCodec* encoder = avcodec_find_encoder(codecId);&#xA;        if(!encoder) { qDebug() &lt;&lt; "failed to find" &lt;&lt; type &lt;&lt; "encoder!"; return false; }&#xA;&#xA;        encoderContext = avcodec_alloc_context3(encoder);&#xA;        if(!encoderContext) { qDebug() &lt;&lt; "failed to create video encoder context!"; return false; }&#xA;&#xA;        configureContextFunc(encoderContext, encoder);&#xA;&#xA;        int result = avcodec_open2(encoderContext, encoder, NULL);&#xA;        if(result &lt; 0) { qDebug() &lt;&lt; "failed to open audio encoder" &lt;&lt; av_make_error(result); return false; }&#xA;        if(avcodec_parameters_from_context(stream->codecpar, encoderContext) &lt; 0) { qDebug() &lt;&lt; "failed to copy parameters to audio output stream"; return false; }&#xA;&#xA;        packet = av_packet_alloc();&#xA;        if(!packet) {qDebug() &lt;&lt; "failed allocate output" &lt;&lt; type &lt;&lt; "packet"; return false;}&#xA;&#xA;        frame = av_frame_alloc();&#xA;        if(!frame) { qDebug() &lt;&lt; "can&#x27;t allocate output" &lt;&lt; type &lt;&lt; "frame"; return false; }&#xA;&#xA;        configureFrameFunc(frame);&#xA;&#xA;        av_frame_get_buffer(frame, 0);&#xA;&#xA;        return true;&#xA;    };&#xA;&#xA;    auto configureAudioFrame = [=](AVFrame* frame)&#xA;    {&#xA;        frame->nb_samples = audioEncoderContext->frame_size;&#xA;        frame->format = audioEncoderContext->sample_fmt;&#xA;        frame->sample_rate = audioEncoderContext->sample_rate;&#xA;        frame->channel_layout = av_get_default_channel_layout(audioDecoderContext->channels);&#xA;    };&#xA;&#xA;    auto configureAudioEncoderContext = [=](AVCodecContext* encoderContext, AVCodec* encoder)&#xA;    {&#xA;        encoderContext->bit_rate = 64000;&#xA;        encoderContext->sample_fmt = encoder->sample_fmts[0];&#xA;        encoderContext->sample_rate = 44100;&#xA;        encoderContext->codec_type = AVMEDIA_TYPE_AUDIO;&#xA;        encoderContext->channel_layout = AV_CH_LAYOUT_STEREO;&#xA;        encoderContext->channels = av_get_channel_layout_nb_channels(encoderContext->channel_layout);&#xA;    };&#xA;&#xA;    auto configureVideoFrame = [=](AVFrame* frame)&#xA;    {&#xA;        frame->format = videoEncoderContext->pix_fmt;&#xA;        frame->width  = videoEncoderContext->width;&#xA;        frame->height = videoEncoderContext->height;&#xA;    };&#xA;&#xA;    auto configureVideoEncoderContext = [=](AVCodecContext* encoderContext, AVCodec* encoder)&#xA;    {&#xA;        encoderContext->width = videoDecoderContext->width;&#xA;        encoderContext->height = videoDecoderContext->height;&#xA;        encoderContext->pix_fmt = encoder->pix_fmts[0];&#xA;        encoderContext->gop_size = 10;&#xA;        encoderContext->max_b_frames = 1;&#xA;        encoderContext->framerate = AVRational{30, 1};&#xA;        encoderContext->time_base = AVRational{1, 30};&#xA;&#xA;        av_opt_set(encoderContext->priv_data, "preset", "ultrafast", 0);&#xA;        av_opt_set(encoderContext->priv_data, "tune", "zerolatency", 0);&#xA;    };&#xA;&#xA;    if(!prepareOutputContext(videoEncoderContext, configureVideoEncoderContext, configureVideoFrame, outputFormat->video_codec, videoOutputFrame, videoOutputPacket, "video")) return false;&#xA;    if(!prepareOutputContext(audioEncoderContext, configureAudioEncoderContext, configureAudioFrame, outputFormat->audio_codec, audioOutputFrame, audioOutputPacket, "audio")) return false;&#xA;&#xA;    if(outputFormat->flags &amp; AVFMT_GLOBALHEADER) outputFormat->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;    int result = 0;&#xA;    if(!(outputFormat->flags &amp; AVFMT_NOFILE))&#xA;        if((result = avio_open(&amp;outputFormatContext->pb, filename, AVIO_FLAG_WRITE)) &lt; 0)&#xA;            { qDebug() &lt;&lt; "failed to open file" &lt;&lt;  av_make_error(result); return false; }&#xA;&#xA;    result = avformat_write_header(outputFormatContext, NULL);&#xA;    if(result &lt; 0) {qDebug() &lt;&lt; "failed to write header!" &lt;&lt; av_make_error(result); return false; }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoReader::configResampler()&#xA;{&#xA;&#xA;    resampleContext = swr_alloc_set_opts(NULL,&#xA;                                         av_get_default_channel_layout(audioEncoderContext->channels),&#xA;                                         audioEncoderContext->sample_fmt,&#xA;                                         audioEncoderContext->sample_rate,&#xA;                                         av_get_default_channel_layout(audioDecoderContext->channels),&#xA;                                         audioDecoderContext->sample_fmt,&#xA;                                         audioDecoderContext->sample_rate,&#xA;                                         0, NULL);&#xA;    if (!resampleContext) { qDebug() &lt;&lt; "Could not allocate resample context"; return false; }&#xA;&#xA;    int error;&#xA;    if ((error = swr_init(resampleContext)) &lt; 0) { qDebug() &lt;&lt; "Could not open resample context"; swr_free(&amp;resampleContext); return false; }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoReader::encode(AVFrame* frame, AVCodecContext* encoderContext, AVPacket* outputPacket, int streamIndex, QString type)&#xA;{&#xA;    int response;&#xA;&#xA;    response = avcodec_send_frame(encoderContext, frame);&#xA;    if(response &lt; 0) { qDebug() &lt;&lt; "failed to send" &lt;&lt; type &lt;&lt; "frame" &lt;&lt; av_make_error(response); return false; }&#xA;&#xA;    while(response >= 0)&#xA;    {&#xA;        response = avcodec_receive_packet(encoderContext, outputPacket);&#xA;        if(response == AVERROR(EAGAIN) || response == AVERROR_EOF) { av_packet_unref(outputPacket); continue; }&#xA;        else if (response &lt; 0) { qDebug() &lt;&lt; "failed to encode" &lt;&lt; type &lt;&lt; "frame!" &lt;&lt; response &lt;&lt; av_make_error(response); return false; }&#xA;&#xA;        outputPacket->stream_index = streamIndex;&#xA;&#xA;        AVStream *inStream = inputFormatContext->streams[streamIndex];&#xA;        AVStream *outStream = outputFormatContext->streams[streamIndex];&#xA;&#xA;        av_packet_rescale_ts(outputPacket, inStream->time_base, outStream->time_base);&#xA;&#xA;        if((response = av_interleaved_write_frame(outputFormatContext, outputPacket)) != 0) { qDebug() &lt;&lt; "Failed to write" &lt;&lt; type &lt;&lt; "packet!" &lt;&lt;  av_make_error(response); av_packet_unref(outputPacket); return false; }&#xA;&#xA;        av_packet_unref(outputPacket);&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;</void></void></void></qdebug>

    &#xA;

    I could try to write down shorter example if needed

    &#xA;

  • Revision 29902 : - mise à jour de l’appel des #SAISIE (celles qui risquent un plantage en ...

    16 juillet 2009, par marcimat@… — Log

    - mise à jour de l’appel des #SAISIE (celles qui risquent un plantage en priorité)
    - mise à jour du plugin.xml

  • Announcing the first free software Blu-ray encoder

    25 avril 2010, par Dark Shikari — blu-ray, x264

    For many years it has been possible to make your own DVDs with free software tools. Over the course of the past decade, DVD creation evolved from the exclusive domain of the media publishing companies to something basically anyone could do on their home computer.

    But Blu-ray has yet to get that treatment. Despite the “format war” between Blu-ray and HD DVD ending over two years ago, free software has lagged behind. “Professional” tools for Blu-ray video encoding can cost as much as $100,000 and are often utter garbage. Here are two actual screenshots from real Blu-rays : I wish I was making this up.

    But today, things change. Today we take the first step towards a free software Blu-ray creation toolkit.

    Thanks to tireless work by Kieran Kunyha, Alex Giladi, Lamont Alston, and the Doom9 crowd, x264 can now produce Blu-ray-compliant video. Extra special thanks to The Criterion Collection for sponsoring the final compliance test to confirm x264′s Blu-ray compliance.

    With x264′s powerful compression, as demonstrated by the incredibly popular BD-Rebuilder Blu-ray backup software, it’s quite possible to author Blu-ray disks on DVD9s (dual-layer DVDs) or even DVD5s (single-layer DVDs) with a reasonable level of quality. With a free software encoder and less need for an expensive Blu-ray burner, we are one step closer to putting HD optical media creation in the hands of the everyday user.

    To celebrate this achievement, we are making available for download a demo Blu-ray encoded with x264, containing entirely free content !

    On this Blu-ray are the Open Movie Project films Big Buck Bunny and Elephant’s Dream, available under a Creative Commons license. Additionally, Microsoft has graciously provided about 6 minutes of lossless HD video and audio (from part of a documentary project) under a very liberal license. This footage rounds out the Blu-ray by adding some difficult live-action content in addition to the relatively compressible CGI footage from the Open Movie Project. Finally, we used this sound sample, available under a Creative Commons license.

    You may notice that the Blu-ray image is only just over 2GB. This is intentional ; we have encoded all the content on the disk at appropriate bitrates to be playable from an ordinary 4.7GB DVD. This should make it far easier to burn a copy of the Blu-ray, since Blu-ray burners and writable media are still relatively rare. Most Blu-ray players will treat a DVD containing Blu-ray data as a normal Blu-ray disc. A few, such as the Playstation 3, will not, but you can still play it as a data disc.

    Finally, note that (in accordance with the Blu-ray spec) the disc image file uses the UDF 2.5 filesystem, which may be incompatible with some older virtual drive and DVD burning applications. You’ll also need to play it on an actual Blu-ray player if you want to get the menus and such working correctly. If you’re looking to play it on a PC, a free trial of Arcsoft TMT is available here.

    What are you waiting for ? Grab a copy today !

    UPDATE : Here is an AVCHD-compliant version of the above, which should work better when burned on a DVD-5 instead of a BD-R. (mirror)

    What’s left before we have a fully free software Blu-ray creation toolkit ? Audio is already dealt with ; AC3 audio (aka Dolby Digital), the format used in DVD, is still supported by Blu-ray, and there are many free software AC3 encoders. The primary missing application is a free software Blu-ray authoring tool, to combine the video and audio streams to create a Blu-ray file structure with the menus, chapters, and so forth that we have all come to expect. But the hardest part is dealt with : we can now create compatible video and audio streams.

    In the meantime, x264 can be used to create streams to be authored using Blu-Print, Scenarist, Encore or other commercial authoring tools.

    More detailed documentation on the new Blu-ray support and how to use it can be found in the official commit message. Do keep in mind that you have to export to raw H.264 (not MKV or MP4) or else the buffering information will be slightly incorrect. Finally, also note that the encoding settings given as an example are not a good choice for general-purpose encoding : they are intentionally crippled by Blu-ray restrictions, which will significantly reduce compression for ordinary non-Blu-ray encoding.

    In addition to Blu-ray support, the aforementioned commit comes with a lot of fun extras :

    x264 now has native variable-framerate ratecontrol, which makes sure your encodes get a correct target bitrate and proper limiting of maximum bitrate even if the duration of every frame is different and the “framerate” is completely unknown. This helps a lot when encoding from variable-framerate container formats such as FLV and WMV, along with variable-framerate content such as anime.

    x264 now supports pulldown (telecine) in much the same fashion as it is handled in MPEG-2. The calling application can pass in flags representing how to display a frame, allowing easy transcoding from MPEG-2 sources with pulldown, such as broadcast television. The x264 commandline app contains some examples of these (such as the common 3:2 pulldown pattern).

    x264 now also exports HRD timing information, which is critical for compliant transport stream muxing. There is currently an active project to write a fully DVB-compatible free software TS muxer that will be able to interface with x264 for a seamless free software broadcast system. It will likely also be possible to repurpose this muxer as part of a free software Blu-ray authoring package.

    All of this is now available in the latest x264.