Recherche avancée

Médias (0)

Mot : - Tags -/signalement

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (99)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • 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 (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (11354)

  • Why does adding audio stream to libavcodec output container causes a crash ?

    19 mars 2021, par Sniggerfardimungus

    As it stands, my project correctly uses libavcodec to decode a video, where each frame is manipulated (it doesn't matter how) and output to a new video. I've cobbled this together from examples found online, and it works. The result is a perfect .mp4 of the manipulated frames, minus the audio.

    


    My problem is, when I try to add an audio stream to the output container, I get a crash in mux.c that I can't explain. It's in static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt). Where st->internal->priv_pts->val = pkt->dts; is attempted, priv_pts is nullptr.

    


    I don't recall the version number, but this is from a November 4, 2020 ffmpeg build from git.

    


    My MediaContentMgr is much bigger than what I have here. I'm stripping out everything to do with the frame manipulation, so if I'm missing anything, please let me know and I'll edit.

    


    The code that, when added, triggers the nullptr exception, is called out inline

    


    The .h :

    


    #ifndef _API_EXAMPLE_H&#xA;#define _API_EXAMPLE_H&#xA;&#xA;#include <glad></glad>glad.h>&#xA;#include <glfw></glfw>glfw3.h>&#xA;#include "glm/glm.hpp"&#xA;&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>avutil.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;}&#xA;&#xA;#include "shader_s.h"&#xA;&#xA;class MediaContainerMgr {&#xA;public:&#xA;    MediaContainerMgr(const std::string&amp; infile, const std::string&amp; vert, const std::string&amp; frag, &#xA;                      const glm::vec3* extents);&#xA;    ~MediaContainerMgr();&#xA;    void render();&#xA;    bool recording() { return m_recording; }&#xA;&#xA;    // Major thanks to "shi-yan" who helped make this possible:&#xA;    // https://github.com/shi-yan/videosamples/blob/master/libavmp4encoding/main.cpp&#xA;    bool init_video_output(const std::string&amp; video_file_name, unsigned int width, unsigned int height);&#xA;    bool output_video_frame(uint8_t* buf);&#xA;    bool finalize_output();&#xA;&#xA;private:&#xA;    AVFormatContext*   m_format_context;&#xA;    AVCodec*           m_video_codec;&#xA;    AVCodec*           m_audio_codec;&#xA;    AVCodecParameters* m_video_codec_parameters;&#xA;    AVCodecParameters* m_audio_codec_parameters;&#xA;    AVCodecContext*    m_codec_context;&#xA;    AVFrame*           m_frame;&#xA;    AVPacket*          m_packet;&#xA;    uint32_t           m_video_stream_index;&#xA;    uint32_t           m_audio_stream_index;&#xA;    &#xA;    void init_rendering(const glm::vec3* extents);&#xA;    int decode_packet();&#xA;&#xA;    // For writing the output video:&#xA;    void free_output_assets();&#xA;    bool                   m_recording;&#xA;    AVOutputFormat*        m_output_format;&#xA;    AVFormatContext*       m_output_format_context;&#xA;    AVCodec*               m_output_video_codec;&#xA;    AVCodecContext*        m_output_video_codec_context;&#xA;    AVFrame*               m_output_video_frame;&#xA;    SwsContext*            m_output_scale_context;&#xA;    AVStream*              m_output_video_stream;&#xA;    &#xA;    AVCodec*               m_output_audio_codec;&#xA;    AVStream*              m_output_audio_stream;&#xA;    AVCodecContext*        m_output_audio_codec_context;&#xA;};&#xA;&#xA;#endif&#xA;

    &#xA;

    And, the hellish .cpp :

    &#xA;

    #include &#xA;#include &#xA;#include &#xA;#include &#xA;#include &#xA;&#xA;#include "media_container_manager.h"&#xA;&#xA;MediaContainerMgr::MediaContainerMgr(const std::string&amp; infile, const std::string&amp; vert, const std::string&amp; frag,&#xA;    const glm::vec3* extents) :&#xA;    m_video_stream_index(-1),&#xA;    m_audio_stream_index(-1),&#xA;    m_recording(false),&#xA;    m_output_format(nullptr),&#xA;    m_output_format_context(nullptr),&#xA;    m_output_video_codec(nullptr),&#xA;    m_output_video_codec_context(nullptr),&#xA;    m_output_video_frame(nullptr),&#xA;    m_output_scale_context(nullptr),&#xA;    m_output_video_stream(nullptr)&#xA;{&#xA;    // AVFormatContext holds header info from the format specified in the container:&#xA;    m_format_context = avformat_alloc_context();&#xA;    if (!m_format_context) {&#xA;        throw "ERROR could not allocate memory for Format Context";&#xA;    }&#xA;    &#xA;    // open the file and read its header. Codecs are not opened here.&#xA;    if (avformat_open_input(&amp;m_format_context, infile.c_str(), NULL, NULL) != 0) {&#xA;        throw "ERROR could not open input file for reading";&#xA;    }&#xA;&#xA;    printf("format %s, duration %lldus, bit_rate %lld\n", m_format_context->iformat->name, m_format_context->duration, m_format_context->bit_rate);&#xA;    //read avPackets (?) from the avFormat (?) to get stream info. This populates format_context->streams.&#xA;    if (avformat_find_stream_info(m_format_context, NULL) &lt; 0) {&#xA;        throw "ERROR could not get stream info";&#xA;    }&#xA;&#xA;    for (unsigned int i = 0; i &lt; m_format_context->nb_streams; i&#x2B;&#x2B;) {&#xA;        AVCodecParameters* local_codec_parameters = NULL;&#xA;        local_codec_parameters = m_format_context->streams[i]->codecpar;&#xA;        printf("AVStream->time base before open coded %d/%d\n", m_format_context->streams[i]->time_base.num, m_format_context->streams[i]->time_base.den);&#xA;        printf("AVStream->r_frame_rate before open coded %d/%d\n", m_format_context->streams[i]->r_frame_rate.num, m_format_context->streams[i]->r_frame_rate.den);&#xA;        printf("AVStream->start_time %" PRId64 "\n", m_format_context->streams[i]->start_time);&#xA;        printf("AVStream->duration %" PRId64 "\n", m_format_context->streams[i]->duration);&#xA;        printf("duration(s): %lf\n", (float)m_format_context->streams[i]->duration / m_format_context->streams[i]->time_base.den * m_format_context->streams[i]->time_base.num);&#xA;        AVCodec* local_codec = NULL;&#xA;        local_codec = avcodec_find_decoder(local_codec_parameters->codec_id);&#xA;        if (local_codec == NULL) {&#xA;            throw "ERROR unsupported codec!";&#xA;        }&#xA;&#xA;        if (local_codec_parameters->codec_type == AVMEDIA_TYPE_VIDEO) {&#xA;            if (m_video_stream_index == -1) {&#xA;                m_video_stream_index = i;&#xA;                m_video_codec = local_codec;&#xA;                m_video_codec_parameters = local_codec_parameters;&#xA;            }&#xA;            m_height = local_codec_parameters->height;&#xA;            m_width = local_codec_parameters->width;&#xA;            printf("Video Codec: resolution %dx%d\n", m_width, m_height);&#xA;        }&#xA;        else if (local_codec_parameters->codec_type == AVMEDIA_TYPE_AUDIO) {&#xA;            if (m_audio_stream_index == -1) {&#xA;                m_audio_stream_index = i;&#xA;                m_audio_codec = local_codec;&#xA;                m_audio_codec_parameters = local_codec_parameters;&#xA;            }&#xA;            printf("Audio Codec: %d channels, sample rate %d\n", local_codec_parameters->channels, local_codec_parameters->sample_rate);&#xA;        }&#xA;&#xA;        printf("\tCodec %s ID %d bit_rate %lld\n", local_codec->name, local_codec->id, local_codec_parameters->bit_rate);&#xA;    }&#xA;&#xA;    m_codec_context = avcodec_alloc_context3(m_video_codec);&#xA;    if (!m_codec_context) {&#xA;        throw "ERROR failed to allocate memory for AVCodecContext";&#xA;    }&#xA;&#xA;    if (avcodec_parameters_to_context(m_codec_context, m_video_codec_parameters) &lt; 0) {&#xA;        throw "ERROR failed to copy codec params to codec context";&#xA;    }&#xA;&#xA;    if (avcodec_open2(m_codec_context, m_video_codec, NULL) &lt; 0) {&#xA;        throw "ERROR avcodec_open2 failed to open codec";&#xA;    }&#xA;&#xA;    m_frame = av_frame_alloc();&#xA;    if (!m_frame) {&#xA;        throw "ERROR failed to allocate AVFrame memory";&#xA;    }&#xA;&#xA;    m_packet = av_packet_alloc();&#xA;    if (!m_packet) {&#xA;        throw "ERROR failed to allocate AVPacket memory";&#xA;    }&#xA;}&#xA;&#xA;MediaContainerMgr::~MediaContainerMgr() {&#xA;    avformat_close_input(&amp;m_format_context);&#xA;    av_packet_free(&amp;m_packet);&#xA;    av_frame_free(&amp;m_frame);&#xA;    avcodec_free_context(&amp;m_codec_context);&#xA;&#xA;&#xA;    glDeleteVertexArrays(1, &amp;m_VAO);&#xA;    glDeleteBuffers(1, &amp;m_VBO);&#xA;}&#xA;&#xA;&#xA;bool MediaContainerMgr::advance_frame() {&#xA;    while (true) {&#xA;        if (av_read_frame(m_format_context, m_packet) &lt; 0) {&#xA;            // Do we actually need to unref the packet if it failed?&#xA;            av_packet_unref(m_packet);&#xA;            continue;&#xA;            //return false;&#xA;        }&#xA;        else {&#xA;            if (m_packet->stream_index == m_video_stream_index) {&#xA;                //printf("AVPacket->pts %" PRId64 "\n", m_packet->pts);&#xA;                int response = decode_packet();&#xA;                av_packet_unref(m_packet);&#xA;                if (response != 0) {&#xA;                    continue;&#xA;                    //return false;&#xA;                }&#xA;                return true;&#xA;            }&#xA;            else {&#xA;                printf("m_packet->stream_index: %d\n", m_packet->stream_index);&#xA;                printf("  m_packet->pts: %lld\n", m_packet->pts);&#xA;                printf("  mpacket->size: %d\n", m_packet->size);&#xA;                if (m_recording) {&#xA;                    int err = 0;&#xA;                    //err = avcodec_send_packet(m_output_video_codec_context, m_packet);&#xA;                    printf("  encoding error: %d\n", err);&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        // We&#x27;re done with the packet (it&#x27;s been unpacked to a frame), so deallocate &amp; reset to defaults:&#xA;/*&#xA;        if (m_frame == NULL)&#xA;            return false;&#xA;&#xA;        if (m_frame->data[0] == NULL || m_frame->data[1] == NULL || m_frame->data[2] == NULL) {&#xA;            printf("WARNING: null frame data");&#xA;            continue;&#xA;        }&#xA;*/&#xA;    }&#xA;}&#xA;&#xA;int MediaContainerMgr::decode_packet() {&#xA;    // Supply raw packet data as input to a decoder&#xA;    // https://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga58bc4bf1e0ac59e27362597e467efff3&#xA;    int response = avcodec_send_packet(m_codec_context, m_packet);&#xA;&#xA;    if (response &lt; 0) {&#xA;        char buf[256];&#xA;        av_strerror(response, buf, 256);&#xA;        printf("Error while receiving a frame from the decoder: %s\n", buf);&#xA;        return response;&#xA;    }&#xA;&#xA;    // Return decoded output data (into a frame) from a decoder&#xA;    // https://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga11e6542c4e66d3028668788a1a74217c&#xA;    response = avcodec_receive_frame(m_codec_context, m_frame);&#xA;    if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {&#xA;        return response;&#xA;    } else if (response &lt; 0) {&#xA;        char buf[256];&#xA;        av_strerror(response, buf, 256);&#xA;        printf("Error while receiving a frame from the decoder: %s\n", buf);&#xA;        return response;&#xA;    } else {&#xA;        printf(&#xA;            "Frame %d (type=%c, size=%d bytes) pts %lld key_frame %d [DTS %d]\n",&#xA;            m_codec_context->frame_number,&#xA;            av_get_picture_type_char(m_frame->pict_type),&#xA;            m_frame->pkt_size,&#xA;            m_frame->pts,&#xA;            m_frame->key_frame,&#xA;            m_frame->coded_picture_number&#xA;        );&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;&#xA;bool MediaContainerMgr::init_video_output(const std::string&amp; video_file_name, unsigned int width, unsigned int height) {&#xA;    if (m_recording)&#xA;        return true;&#xA;    m_recording = true;&#xA;&#xA;    advance_to(0L); // I&#x27;ve deleted the implmentation. Just seeks to beginning of vid. Works fine.&#xA;&#xA;    if (!(m_output_format = av_guess_format(nullptr, video_file_name.c_str(), nullptr))) {&#xA;        printf("Cannot guess output format.\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    int err = avformat_alloc_output_context2(&amp;m_output_format_context, m_output_format, nullptr, video_file_name.c_str());&#xA;    if (err &lt; 0) {&#xA;        printf("Failed to allocate output context.\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    //TODO(P0): Break out the video and audio inits into their own methods.&#xA;    m_output_video_codec = avcodec_find_encoder(m_output_format->video_codec);&#xA;    if (!m_output_video_codec) {&#xA;        printf("Failed to create video codec.\n");&#xA;        return false;&#xA;    }&#xA;    m_output_video_stream = avformat_new_stream(m_output_format_context, m_output_video_codec);&#xA;    if (!m_output_video_stream) {&#xA;        printf("Failed to find video format.\n");&#xA;        return false;&#xA;    } &#xA;    m_output_video_codec_context = avcodec_alloc_context3(m_output_video_codec);&#xA;    if (!m_output_video_codec_context) {&#xA;        printf("Failed to create video codec context.\n");&#xA;        return(false);&#xA;    }&#xA;    m_output_video_stream->codecpar->codec_id = m_output_format->video_codec;&#xA;    m_output_video_stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    m_output_video_stream->codecpar->width = width;&#xA;    m_output_video_stream->codecpar->height = height;&#xA;    m_output_video_stream->codecpar->format = AV_PIX_FMT_YUV420P;&#xA;    // Use the same bit rate as the input stream.&#xA;    m_output_video_stream->codecpar->bit_rate = m_format_context->streams[m_video_stream_index]->codecpar->bit_rate;&#xA;    m_output_video_stream->avg_frame_rate = m_format_context->streams[m_video_stream_index]->avg_frame_rate;&#xA;    avcodec_parameters_to_context(m_output_video_codec_context, m_output_video_stream->codecpar);&#xA;    m_output_video_codec_context->time_base = m_format_context->streams[m_video_stream_index]->time_base;&#xA;    &#xA;    //TODO(P1): Set these to match the input stream?&#xA;    m_output_video_codec_context->max_b_frames = 2;&#xA;    m_output_video_codec_context->gop_size = 12;&#xA;    m_output_video_codec_context->framerate = m_format_context->streams[m_video_stream_index]->r_frame_rate;&#xA;    //m_output_codec_context->refcounted_frames = 0;&#xA;    if (m_output_video_stream->codecpar->codec_id == AV_CODEC_ID_H264) {&#xA;        av_opt_set(m_output_video_codec_context, "preset", "ultrafast", 0);&#xA;    } else if (m_output_video_stream->codecpar->codec_id == AV_CODEC_ID_H265) {&#xA;        av_opt_set(m_output_video_codec_context, "preset", "ultrafast", 0);&#xA;    } else {&#xA;        av_opt_set_int(m_output_video_codec_context, "lossless", 1, 0);&#xA;    }&#xA;    avcodec_parameters_from_context(m_output_video_stream->codecpar, m_output_video_codec_context);&#xA;&#xA;    m_output_audio_codec = avcodec_find_encoder(m_output_format->audio_codec);&#xA;    if (!m_output_audio_codec) {&#xA;        printf("Failed to create audio codec.\n");&#xA;        return false;&#xA;    }&#xA;

    &#xA;

    I've commented out all of the audio stream init beyond this next line, because this is where&#xA;the trouble begins. Creating this output stream causes the null reference I mentioned. If I&#xA;uncomment everything below here, I still get the null deref. If I comment out this line, the&#xA;deref exception vanishes. (IOW, I commented out more and more code until I found that this&#xA;was the trigger that caused the problem.)

    &#xA;

    I assume that there's something I'm doing wrong in the rest of the commented out code, that,&#xA;when fixed, will fix the nullptr and give me a working audio stream.

    &#xA;

        m_output_audio_stream = avformat_new_stream(m_output_format_context, m_output_audio_codec);&#xA;    if (!m_output_audio_stream) {&#xA;        printf("Failed to find audio format.\n");&#xA;        return false;&#xA;    }&#xA;    /*&#xA;    m_output_audio_codec_context = avcodec_alloc_context3(m_output_audio_codec);&#xA;    if (!m_output_audio_codec_context) {&#xA;        printf("Failed to create audio codec context.\n");&#xA;        return(false);&#xA;    }&#xA;    m_output_audio_stream->codecpar->codec_id = m_output_format->audio_codec;&#xA;    m_output_audio_stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;&#xA;    m_output_audio_stream->codecpar->format = m_format_context->streams[m_audio_stream_index]->codecpar->format;&#xA;    m_output_audio_stream->codecpar->bit_rate = m_format_context->streams[m_audio_stream_index]->codecpar->bit_rate;&#xA;    m_output_audio_stream->avg_frame_rate = m_format_context->streams[m_audio_stream_index]->avg_frame_rate;&#xA;    avcodec_parameters_to_context(m_output_audio_codec_context, m_output_audio_stream->codecpar);&#xA;    m_output_audio_codec_context->time_base = m_format_context->streams[m_audio_stream_index]->time_base;&#xA;    */&#xA;&#xA;    //TODO(P2): Free assets that have been allocated.&#xA;    err = avcodec_open2(m_output_video_codec_context, m_output_video_codec, nullptr);&#xA;    if (err &lt; 0) {&#xA;        printf("Failed to open codec.\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    if (!(m_output_format->flags &amp; AVFMT_NOFILE)) {&#xA;        err = avio_open(&amp;m_output_format_context->pb, video_file_name.c_str(), AVIO_FLAG_WRITE);&#xA;        if (err &lt; 0) {&#xA;            printf("Failed to open output file.");&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    err = avformat_write_header(m_output_format_context, NULL);&#xA;    if (err &lt; 0) {&#xA;        printf("Failed to write header.\n");&#xA;        return false;&#xA;    }&#xA;&#xA;    av_dump_format(m_output_format_context, 0, video_file_name.c_str(), 1);&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;&#xA;//TODO(P2): make this a member. (Thanks to https://emvlo.wordpress.com/2016/03/10/sws_scale/)&#xA;void PrepareFlipFrameJ420(AVFrame* pFrame) {&#xA;    for (int i = 0; i &lt; 4; i&#x2B;&#x2B;) {&#xA;        if (i)&#xA;            pFrame->data[i] &#x2B;= pFrame->linesize[i] * ((pFrame->height >> 1) - 1);&#xA;        else&#xA;            pFrame->data[i] &#x2B;= pFrame->linesize[i] * (pFrame->height - 1);&#xA;        pFrame->linesize[i] = -pFrame->linesize[i];&#xA;    }&#xA;}&#xA;

    &#xA;

    This is where we take an altered frame and write it to the output container. This works fine&#xA;as long as we haven't set up an audio stream in the output container.

    &#xA;

    bool MediaContainerMgr::output_video_frame(uint8_t* buf) {&#xA;    int err;&#xA;&#xA;    if (!m_output_video_frame) {&#xA;        m_output_video_frame = av_frame_alloc();&#xA;        m_output_video_frame->format = AV_PIX_FMT_YUV420P;&#xA;        m_output_video_frame->width = m_output_video_codec_context->width;&#xA;        m_output_video_frame->height = m_output_video_codec_context->height;&#xA;        err = av_frame_get_buffer(m_output_video_frame, 32);&#xA;        if (err &lt; 0) {&#xA;            printf("Failed to allocate output frame.\n");&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    if (!m_output_scale_context) {&#xA;        m_output_scale_context = sws_getContext(m_output_video_codec_context->width, m_output_video_codec_context->height, &#xA;                                                AV_PIX_FMT_RGB24,&#xA;                                                m_output_video_codec_context->width, m_output_video_codec_context->height, &#xA;                                                AV_PIX_FMT_YUV420P, SWS_BICUBIC, nullptr, nullptr, nullptr);&#xA;    }&#xA;&#xA;    int inLinesize[1] = { 3 * m_output_video_codec_context->width };&#xA;    sws_scale(m_output_scale_context, (const uint8_t* const*)&amp;buf, inLinesize, 0, m_output_video_codec_context->height,&#xA;              m_output_video_frame->data, m_output_video_frame->linesize);&#xA;    PrepareFlipFrameJ420(m_output_video_frame);&#xA;    //TODO(P0): Switch m_frame to be m_input_video_frame so I don&#x27;t end up using the presentation timestamp from&#xA;    //          an audio frame if I threadify the frame reading.&#xA;    m_output_video_frame->pts = m_frame->pts;&#xA;    printf("Output PTS: %d, time_base: %d/%d\n", m_output_video_frame->pts,&#xA;        m_output_video_codec_context->time_base.num, m_output_video_codec_context->time_base.den);&#xA;    err = avcodec_send_frame(m_output_video_codec_context, m_output_video_frame);&#xA;    if (err &lt; 0) {&#xA;        printf("  ERROR sending new video frame output: ");&#xA;        switch (err) {&#xA;        case AVERROR(EAGAIN):&#xA;            printf("AVERROR(EAGAIN): %d\n", err);&#xA;            break;&#xA;        case AVERROR_EOF:&#xA;            printf("AVERROR_EOF: %d\n", err);&#xA;            break;&#xA;        case AVERROR(EINVAL):&#xA;            printf("AVERROR(EINVAL): %d\n", err);&#xA;            break;&#xA;        case AVERROR(ENOMEM):&#xA;            printf("AVERROR(ENOMEM): %d\n", err);&#xA;            break;&#xA;        }&#xA;&#xA;        return false;&#xA;    }&#xA;&#xA;    AVPacket pkt;&#xA;    av_init_packet(&amp;pkt);&#xA;    pkt.data = nullptr;&#xA;    pkt.size = 0;&#xA;    pkt.flags |= AV_PKT_FLAG_KEY;&#xA;    int ret = 0;&#xA;    if ((ret = avcodec_receive_packet(m_output_video_codec_context, &amp;pkt)) == 0) {&#xA;        static int counter = 0;&#xA;        printf("pkt.key: 0x%08x, pkt.size: %d, counter:\n", pkt.flags &amp; AV_PKT_FLAG_KEY, pkt.size, counter&#x2B;&#x2B;);&#xA;        uint8_t* size = ((uint8_t*)pkt.data);&#xA;        printf("sizes: %d %d %d %d %d %d %d %d %d\n", size[0], size[1], size[2], size[2], size[3], size[4], size[5], size[6], size[7]);&#xA;        av_interleaved_write_frame(m_output_format_context, &amp;pkt);&#xA;    }&#xA;    printf("push: %d\n", ret);&#xA;    av_packet_unref(&amp;pkt);&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool MediaContainerMgr::finalize_output() {&#xA;    if (!m_recording)&#xA;        return true;&#xA;&#xA;    AVPacket pkt;&#xA;    av_init_packet(&amp;pkt);&#xA;    pkt.data = nullptr;&#xA;    pkt.size = 0;&#xA;&#xA;    for (;;) {&#xA;        avcodec_send_frame(m_output_video_codec_context, nullptr);&#xA;        if (avcodec_receive_packet(m_output_video_codec_context, &amp;pkt) == 0) {&#xA;            av_interleaved_write_frame(m_output_format_context, &amp;pkt);&#xA;            printf("final push:\n");&#xA;        } else {&#xA;            break;&#xA;        }&#xA;    }&#xA;&#xA;    av_packet_unref(&amp;pkt);&#xA;&#xA;    av_write_trailer(m_output_format_context);&#xA;    if (!(m_output_format->flags &amp; AVFMT_NOFILE)) {&#xA;        int err = avio_close(m_output_format_context->pb);&#xA;        if (err &lt; 0) {&#xA;            printf("Failed to close file. err: %d\n", err);&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;

    &#xA;

  • Google Speech API returns empty result for some FLAC files, and not for the others although they have same codec and sample rate

    15 mars 2021, par Chad

    Below code is what I used to make request for transcription.

    &#xA;

    import io&#xA;from google.cloud import speech_v1p1beta1 as speech&#xA;def transcribe_file(speech_file):&#xA;    """Transcribe the given audio file."""&#xA;&#xA;    client = speech.SpeechClient()&#xA;&#xA;    encoding = speech.RecognitionConfig.AudioEncoding.FLAC&#xA;    if os.path.splitext(speech_file)[1] == ".wav":&#xA;        encoding = speech.RecognitionConfig.AudioEncoding.LINEAR16&#xA;    with io.open(speech_file, "rb") as audio_file:&#xA;        content = audio_file.read()&#xA;&#xA;    audio = speech.RecognitionAudio(content=content)&#xA;    config = speech.RecognitionConfig(&#xA;        encoding=speech.RecognitionConfig.AudioEncoding.FLAC,&#xA;        sample_rate_hertz=32000,&#xA;        language_code="ja-JP",&#xA;        max_alternatives=3,&#xA;        enable_word_time_offsets=True,&#xA;        enable_automatic_punctuation=True,&#xA;        enable_word_confidence=True,&#xA;    )&#xA;&#xA;    response = client.recognize(config=config, audio=audio)&#xA;    #print(speech_file, "Recognition Done")&#xA;    return response&#xA;

    &#xA;

    As I wrote in title, the results of response has empty list for some files, and not for some files.&#xA;They have same sample rate and codec(32000, FLAC)

    &#xA;

    Below is the result of ffprobe -i "AUDIOFILE" -show_streams for one of each cases.

    &#xA;

    Left one is empty one. The only difference is duration of file.

    &#xA;

    How can I get non empty results ?

    &#xA;

    Result of ffprobe

    &#xA;

    Edit :

    &#xA;

    Result of ffprobe show stream show format

    &#xA;

    Something not captured in one screen

    &#xA;

    Sadly, re-mux didn't work.

    &#xA;

    I used ffmpeg-git-20210225

    &#xA;

    ffbrobe result of broken one

    &#xA;

    ./ffprobe -show_streams -show_format broken.flac &#xA;ffprobe version N-56320-ge937457b7b-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2021 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg&#xA;  libavutil      56. 66.100 / 56. 66.100&#xA;  libavcodec     58.125.101 / 58.125.101&#xA;  libavformat    58. 68.100 / 58. 68.100&#xA;  libavdevice    58. 12.100 / 58. 12.100&#xA;  libavfilter     7.107.100 /  7.107.100&#xA;  libswscale      5.  8.100 /  5.  8.100&#xA;  libswresample   3.  8.100 /  3.  8.100&#xA;  libpostproc    55.  8.100 / 55.  8.100&#xA;Input #0, flac, from &#x27;broken.flac&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.45.100&#xA;  Duration: 00:00:00.90, start: 0.000000, bitrate: 342 kb/s&#xA;  Stream #0:0: Audio: flac, 32000 Hz, mono, s16&#xA;[STREAM]&#xA;index=0&#xA;codec_name=flac&#xA;codec_long_name=FLAC (Free Lossless Audio Codec)&#xA;profile=unknown&#xA;codec_type=audio&#xA;codec_tag_string=[0][0][0][0]&#xA;codec_tag=0x0000&#xA;sample_fmt=s16&#xA;sample_rate=32000&#xA;channels=1&#xA;channel_layout=mono&#xA;bits_per_sample=0&#xA;id=N/A&#xA;r_frame_rate=0/0&#xA;avg_frame_rate=0/0&#xA;time_base=1/32000&#xA;start_pts=0&#xA;start_time=0.000000&#xA;duration_ts=28672&#xA;duration=0.896000&#xA;bit_rate=N/A&#xA;max_bit_rate=N/A&#xA;bits_per_raw_sample=16&#xA;nb_frames=N/A&#xA;nb_read_frames=N/A&#xA;nb_read_packets=N/A&#xA;DISPOSITION:default=0&#xA;DISPOSITION:dub=0&#xA;DISPOSITION:original=0&#xA;DISPOSITION:comment=0&#xA;DISPOSITION:lyrics=0&#xA;DISPOSITION:karaoke=0&#xA;DISPOSITION:forced=0&#xA;DISPOSITION:hearing_impaired=0&#xA;DISPOSITION:visual_impaired=0&#xA;DISPOSITION:clean_effects=0&#xA;DISPOSITION:attached_pic=0&#xA;DISPOSITION:timed_thumbnails=0&#xA;[/STREAM]&#xA;[FORMAT]&#xA;filename=broken.flac&#xA;nb_streams=1&#xA;nb_programs=0&#xA;format_name=flac&#xA;format_long_name=raw FLAC&#xA;start_time=0.000000&#xA;duration=0.896000&#xA;size=38362&#xA;bit_rate=342517&#xA;probe_score=100&#xA;TAG:encoder=Lavf58.45.100&#xA;[/FORMAT]&#xA;

    &#xA;

    ffprobe result of non_broken one

    &#xA;

    ./ffprobe -show_streams -show_format non_broken.flac &#xA;ffprobe version N-56320-ge937457b7b-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2021 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg&#xA;  libavutil      56. 66.100 / 56. 66.100&#xA;  libavcodec     58.125.101 / 58.125.101&#xA;  libavformat    58. 68.100 / 58. 68.100&#xA;  libavdevice    58. 12.100 / 58. 12.100&#xA;  libavfilter     7.107.100 /  7.107.100&#xA;  libswscale      5.  8.100 /  5.  8.100&#xA;  libswresample   3.  8.100 /  3.  8.100&#xA;  libpostproc    55.  8.100 / 55.  8.100&#xA;Input #0, flac, from &#x27;non_broken.flac&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.45.100&#xA;  Duration: 00:00:00.86, start: 0.000000, bitrate: 358 kb/s&#xA;  Stream #0:0: Audio: flac, 32000 Hz, mono, s16&#xA;[STREAM]&#xA;index=0&#xA;codec_name=flac&#xA;codec_long_name=FLAC (Free Lossless Audio Codec)&#xA;profile=unknown&#xA;codec_type=audio&#xA;codec_tag_string=[0][0][0][0]&#xA;codec_tag=0x0000&#xA;sample_fmt=s16&#xA;sample_rate=32000&#xA;channels=1&#xA;channel_layout=mono&#xA;bits_per_sample=0&#xA;id=N/A&#xA;r_frame_rate=0/0&#xA;avg_frame_rate=0/0&#xA;time_base=1/32000&#xA;start_pts=0&#xA;start_time=0.000000&#xA;duration_ts=27648&#xA;duration=0.864000&#xA;bit_rate=N/A&#xA;max_bit_rate=N/A&#xA;bits_per_raw_sample=16&#xA;nb_frames=N/A&#xA;nb_read_frames=N/A&#xA;nb_read_packets=N/A&#xA;DISPOSITION:default=0&#xA;DISPOSITION:dub=0&#xA;DISPOSITION:original=0&#xA;DISPOSITION:comment=0&#xA;DISPOSITION:lyrics=0&#xA;DISPOSITION:karaoke=0&#xA;DISPOSITION:forced=0&#xA;DISPOSITION:hearing_impaired=0&#xA;DISPOSITION:visual_impaired=0&#xA;DISPOSITION:clean_effects=0&#xA;DISPOSITION:attached_pic=0&#xA;DISPOSITION:timed_thumbnails=0&#xA;[/STREAM]&#xA;[FORMAT]&#xA;filename=non_broken.flac&#xA;nb_streams=1&#xA;nb_programs=0&#xA;format_name=flac&#xA;format_long_name=raw FLAC&#xA;start_time=0.000000&#xA;duration=0.864000&#xA;size=38701&#xA;bit_rate=358342&#xA;probe_score=100&#xA;TAG:encoder=Lavf58.45.100&#xA;[/FORMAT]&#xA;

    &#xA;

    And the result of ffmpeg -f lavfi -i sine=d=0.864:r=32000 output.flac

    &#xA;

    ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)&#xA;  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared&#xA;  WARNING: library configuration mismatch&#xA;  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc&#xA;  libavutil      55. 78.100 / 55. 78.100&#xA;  libavcodec     57.107.100 / 57.107.100&#xA;  libavformat    57. 83.100 / 57. 83.100&#xA;  libavdevice    57. 10.100 / 57. 10.100&#xA;  libavfilter     6.107.100 /  6.107.100&#xA;  libavresample   3.  7.  0 /  3.  7.  0&#xA;  libswscale      4.  8.100 /  4.  8.100&#xA;  libswresample   2.  9.100 /  2.  9.100&#xA;  libpostproc    54.  7.100 / 54.  7.100&#xA;Input #0, lavfi, from &#x27;sine=d=0.864:r=32000&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 512 kb/s&#xA;    Stream #0:0: Audio: pcm_s16le, 32000 Hz, mono, s16, 512 kb/s&#xA;File &#x27;output.flac&#x27; already exists. Overwrite ? [y/N] y&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))&#xA;Press [q] to stop, [?] for help&#xA;Output #0, flac, to &#x27;output.flac&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf57.83.100&#xA;    Stream #0:0: Audio: flac, 32000 Hz, mono, s16, 128 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc57.107.100 flac&#xA;[Parsed_sine_0 @ 0x55c317ddda00] EOF timestamp not reliable&#xA;size=      16kB time=00:00:00.86 bitrate= 154.0kbits/s speed= 205x    &#xA;video:0kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 99.364586%&#xA;

    &#xA;

  • ffmpeg - 'hevc' codec changed to 'rawvideo' after copying video codec

    11 mars 2021, par Md Yeamin

    I am trying to convert some mkv videos with hevc codec to avi format. For this I run the following command :

    &#xA;

    ffmpeg -i input.mkv -vcodec copy -acodec copy out.avi&#xA;

    &#xA;

    For some video this command works without any issue. But in some cases video does converted, but I can not play those files in any video player. I've tried several video players including VLC, SMPlayer, Deepin Movie etc.

    &#xA;

    After looking into the video codec of converted video I can see that the video codec got transformed from hevc to rawvideo. Hers is the stream information of the original and the converted video files :

    &#xA;

    Input File

    &#xA;

    ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)&#xA;  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;[matroska,webm @ 0x561d8e639600] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;Input #0, matroska,webm, from &#x27;PE2_Leopard_4K_hevc_dts.mkv&#x27;:&#xA;  Metadata:&#xA;    title           : Planet Earth II S01E01 4K&#xA;    encoder         : libebml v1.3.5 &#x2B; libmatroska v1.4.8&#xA;    creation_time   : 2017-10-29T06:31:02.000000Z&#xA;  Duration: 00:00:04.22, start: 0.000000, bitrate: 46848 kb/s&#xA;    Chapter #0:0: start 0.000000, end 4.216000&#xA;    Metadata:&#xA;      title           : 00:00:00.000&#xA;    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)&#xA;    Metadata:&#xA;      BPS             : 44365437&#xA;      BPS-eng         : 44365437&#xA;      DURATION        : 00:00:04.212000000&#xA;      DURATION-eng    : 00:00:04.212000000&#xA;      NUMBER_OF_FRAMES: 101&#xA;      NUMBER_OF_FRAMES-eng: 101&#xA;      NUMBER_OF_BYTES : 23358403&#xA;      NUMBER_OF_BYTES-eng: 23358403&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;    Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), s16p (default)&#xA;    Metadata:&#xA;      title           : DTS-HD MA 5.1&#xA;      BPS             : 2506995&#xA;      BPS-eng         : 2506995&#xA;      DURATION        : 00:00:04.214000000&#xA;      DURATION-eng    : 00:00:04.214000000&#xA;      NUMBER_OF_FRAMES: 395&#xA;      NUMBER_OF_FRAMES-eng: 395&#xA;      NUMBER_OF_BYTES : 1320560&#xA;      NUMBER_OF_BYTES-eng: 1320560&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;    Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle&#xA;    Metadata:&#xA;      title           : English (SDH)&#xA;      BPS             : 0&#xA;      BPS-eng         : 0&#xA;      DURATION        : 00:00:00.000000000&#xA;      DURATION-eng    : 00:00:00.000000000&#xA;      NUMBER_OF_FRAMES: 0&#xA;      NUMBER_OF_FRAMES-eng: 0&#xA;      NUMBER_OF_BYTES : 0&#xA;      NUMBER_OF_BYTES-eng: 0&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;

    &#xA;

    Output File

    &#xA;

    ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)&#xA;  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, avi, from &#x27;out3.avi&#x27;:&#xA;  Metadata:&#xA;    title           : Planet Earth II S01E01 4K&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:04.27, start: 0.000000, bitrate: 44226 kb/s&#xA;    Stream #0:0: Video: rawvideo, bgr24, 3840x2160, 44803 kb/s, SAR 1:1 DAR 16:9, 47.95 fps, 47.95 tbr, 47.95 tbn, 47.95 tbc&#xA;    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1(side), fltp, 394 kb/s&#xA;    Metadata:&#xA;      title           : DTS-HD MA 5.1&#xA;

    &#xA;

    Command Log

    &#xA;

    ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)&#xA;  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;[matroska,webm @ 0x55d6eebb8700] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;Input #0, matroska,webm, from &#x27;PE2_Leopard_4K_hevc_dts.mkv&#x27;:&#xA;  Metadata:&#xA;    title           : Planet Earth II S01E01 4K&#xA;    encoder         : libebml v1.3.5 &#x2B; libmatroska v1.4.8&#xA;    creation_time   : 2017-10-29T06:31:02.000000Z&#xA;  Duration: 00:00:04.22, start: 0.000000, bitrate: 46848 kb/s&#xA;    Chapter #0:0: start 0.000000, end 4.216000&#xA;    Metadata:&#xA;      title           : 00:00:00.000&#xA;    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)&#xA;    Metadata:&#xA;      BPS             : 44365437&#xA;      BPS-eng         : 44365437&#xA;      DURATION        : 00:00:04.212000000&#xA;      DURATION-eng    : 00:00:04.212000000&#xA;      NUMBER_OF_FRAMES: 101&#xA;      NUMBER_OF_FRAMES-eng: 101&#xA;      NUMBER_OF_BYTES : 23358403&#xA;      NUMBER_OF_BYTES-eng: 23358403&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;    Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), s16p (default)&#xA;    Metadata:&#xA;      title           : DTS-HD MA 5.1&#xA;      BPS             : 2506995&#xA;      BPS-eng         : 2506995&#xA;      DURATION        : 00:00:04.214000000&#xA;      DURATION-eng    : 00:00:04.214000000&#xA;      NUMBER_OF_FRAMES: 395&#xA;      NUMBER_OF_FRAMES-eng: 395&#xA;      NUMBER_OF_BYTES : 1320560&#xA;      NUMBER_OF_BYTES-eng: 1320560&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;    Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle&#xA;    Metadata:&#xA;      title           : English (SDH)&#xA;      BPS             : 0&#xA;      BPS-eng         : 0&#xA;      DURATION        : 00:00:00.000000000&#xA;      DURATION-eng    : 00:00:00.000000000&#xA;      NUMBER_OF_FRAMES: 0&#xA;      NUMBER_OF_FRAMES-eng: 0&#xA;      NUMBER_OF_BYTES : 0&#xA;      NUMBER_OF_BYTES-eng: 0&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;Output #0, avi, to &#x27;output.avi&#x27;:&#xA;  Metadata:&#xA;    INAM            : Planet Earth II S01E01 4K&#xA;    ISFT            : Lavf58.29.100&#xA;    Chapter #0:0: start 0.000000, end 4.216000&#xA;    Metadata:&#xA;      title           : 00:00:00.000&#xA;    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 47.95 tbn, 47.95 tbc (default)&#xA;    Metadata:&#xA;      BPS             : 44365437&#xA;      BPS-eng         : 44365437&#xA;      DURATION        : 00:00:04.212000000&#xA;      DURATION-eng    : 00:00:04.212000000&#xA;      NUMBER_OF_FRAMES: 101&#xA;      NUMBER_OF_FRAMES-eng: 101&#xA;      NUMBER_OF_BYTES : 23358403&#xA;      NUMBER_OF_BYTES-eng: 23358403&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;    Stream #0:1(eng): Audio: dts (DTS-HD MA) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side), s16p (default)&#xA;    Metadata:&#xA;      title           : DTS-HD MA 5.1&#xA;      BPS             : 2506995&#xA;      BPS-eng         : 2506995&#xA;      DURATION        : 00:00:04.214000000&#xA;      DURATION-eng    : 00:00:04.214000000&#xA;      NUMBER_OF_FRAMES: 395&#xA;      NUMBER_OF_FRAMES-eng: 395&#xA;      NUMBER_OF_BYTES : 1320560&#xA;      NUMBER_OF_BYTES-eng: 1320560&#xA;      _STATISTICS_WRITING_APP: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_APP-eng: mkvmerge v16.0.0 (&#x27;Protest&#x27;) 64-bit&#xA;      _STATISTICS_WRITING_DATE_UTC: 2017-10-29 06:31:02&#xA;      _STATISTICS_WRITING_DATE_UTC-eng: 2017-10-29 06:31:02&#xA;      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (copy)&#xA;  Stream #0:1 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;frame=  101 fps=0.0 q=-1.0 Lsize=   28904kB time=00:00:04.20 bitrate=56322.1kbits/s speed= 119x    &#xA;video:22811kB audio:1290kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 19.929108%&#xA;

    &#xA;

    How to resolve this issue ?

    &#xA;