Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (111)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (9629)

  • ERROR "Application provided invalid, non monotonically increasing dts to muxer in stream 1 : 6874 >= 6874" while writing encoded output to an mp4 file

    11 mai 2023, par lokit khemka

    I have a running RTSP stream, streaming video on a loop using the following FFMPEG command :

    


    ffmpeg -re -stream_loop -1 -i ./ffmpeg_c_test/small_bunny_1080p_60fps.mp4 -ac 2 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream


    


    The video file is obtained from the github link : https://github.com/leandromoreira/ffmpeg-libav-tutorial

    


    I keep getting error response, when I calling the function av_interleaved_write_frame called from the function remux in the attached program. The output format is mp4, output video codec is av1 and output audio codec is same as input audio codec. The error is from audio stream.

    


    I tried to create a "minimal reproducible code", however, I think it is still not completely minimal, but it reproduces the exact error.

    


    #include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>timestamp.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include &#xA;#include &#xA;#include &#xA;&#xA;#include &#xA;#include &#xA;&#xA;typedef struct StreamingContext{&#xA;    AVFormatContext* avfc;&#xA;    const AVCodec *video_avc;&#xA;    const AVCodec *audio_avc;&#xA;    AVStream *video_avs;&#xA;    AVStream *audio_avs;&#xA;    AVCodecContext *video_avcc;&#xA;    AVCodecContext *audio_avcc;&#xA;    int video_index;&#xA;    int audio_index;&#xA;    char* filename;&#xA;    struct SwsContext *sws_ctx;&#xA;}StreamingContext;&#xA;&#xA;&#xA;typedef struct StreamingParams{&#xA;    char copy_video;&#xA;    char copy_audio;&#xA;    char *output_extension;&#xA;    char *muxer_opt_key;&#xA;    char *muxer_opt_value;&#xA;    char *video_codec;&#xA;    char *audio_codec;&#xA;    char *codec_priv_key;&#xA;    char *codec_priv_value;&#xA;}StreamingParams;&#xA;&#xA;void logging(const char *fmt, ...)&#xA;{&#xA;    va_list args;&#xA;    fprintf(stderr, "LOG: ");&#xA;    va_start(args, fmt);&#xA;    vfprintf(stderr, fmt, args);&#xA;    va_end(args);&#xA;    fprintf(stderr, "\n");&#xA;}&#xA;&#xA;int fill_stream_info(AVStream *avs, const AVCodec **avc, AVCodecContext **avcc)&#xA;{&#xA;    *avc = avcodec_find_decoder(avs->codecpar->codec_id);&#xA;    *avcc = avcodec_alloc_context3(*avc);&#xA;    if (avcodec_parameters_to_context(*avcc, avs->codecpar) &lt; 0)&#xA;    {&#xA;        logging("Failed to fill Codec Context.");&#xA;        return -1;&#xA;    }&#xA;    avcodec_open2(*avcc, *avc, NULL);&#xA;    return 0;&#xA;}&#xA;&#xA;int open_media(const char *in_filename, AVFormatContext **avfc)&#xA;{&#xA;    *avfc = avformat_alloc_context();&#xA;    if (avformat_open_input(avfc, in_filename, NULL, NULL) != 0)&#xA;    {&#xA;        logging("Failed to open input file %s", in_filename);&#xA;        return -1;&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(*avfc, NULL) &lt; 0)&#xA;    {&#xA;        logging("Failed to get Stream Info.");&#xA;        return -1;&#xA;    }&#xA;}&#xA;&#xA;int prepare_decoder(StreamingContext *sc)&#xA;{&#xA;    for (int i = 0; i &lt; (int)sc->avfc->nb_streams; i&#x2B;&#x2B;)&#xA;    {&#xA;        if (sc->avfc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;        {&#xA;            sc->video_avs = sc->avfc->streams[i];&#xA;            sc->video_index = i;&#xA;&#xA;            if (fill_stream_info(sc->video_avs, &amp;sc->video_avc, &amp;sc->video_avcc))&#xA;            {&#xA;                return -1;&#xA;            }&#xA;        }&#xA;        else if (sc->avfc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)&#xA;        {&#xA;            sc->audio_avs = sc->avfc->streams[i];&#xA;            sc->audio_index = i;&#xA;&#xA;            if (fill_stream_info(sc->audio_avs, &amp;sc->audio_avc, &amp;sc->audio_avcc))&#xA;            {&#xA;                return -1;&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            logging("Skipping Streams other than Audio and Video.");&#xA;        }&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;int prepare_video_encoder(StreamingContext *encoder_sc, AVCodecContext *decoder_ctx, AVRational input_framerate,&#xA;                          StreamingParams sp, int scaled_frame_width, int scaled_frame_height)&#xA;{&#xA;    encoder_sc->video_avs = avformat_new_stream(encoder_sc->avfc, NULL);&#xA;    encoder_sc->video_avc = avcodec_find_encoder_by_name(sp.video_codec);&#xA;    if (!encoder_sc->video_avc)&#xA;    {&#xA;        logging("Cannot find the Codec.");&#xA;        return -1;&#xA;    }&#xA;&#xA;    encoder_sc->video_avcc = avcodec_alloc_context3(encoder_sc->video_avc);&#xA;    if (!encoder_sc->video_avcc)&#xA;    {&#xA;        logging("Could not allocate memory for Codec Context.");&#xA;        return -1;&#xA;    }&#xA;&#xA;    av_opt_set(encoder_sc->video_avcc->priv_data, "preset", "fast", 0);&#xA;    if (sp.codec_priv_key &amp;&amp; sp.codec_priv_value)&#xA;        av_opt_set(encoder_sc->video_avcc->priv_data, sp.codec_priv_key, sp.codec_priv_value, 0);&#xA;&#xA;    encoder_sc->video_avcc->height = scaled_frame_height;&#xA;    encoder_sc->video_avcc->width = scaled_frame_width;&#xA;    encoder_sc->video_avcc->sample_aspect_ratio = decoder_ctx->sample_aspect_ratio;&#xA;&#xA;    if (encoder_sc->video_avc->pix_fmts)&#xA;        encoder_sc->video_avcc->pix_fmt = encoder_sc->video_avc->pix_fmts[0];&#xA;    else&#xA;        encoder_sc->video_avcc->pix_fmt = decoder_ctx->pix_fmt;&#xA;&#xA;    encoder_sc->video_avcc->bit_rate = 2 * 1000 * 1000;&#xA;&#xA;    encoder_sc->video_avcc->time_base = av_inv_q(input_framerate);&#xA;    encoder_sc->video_avs->time_base = encoder_sc->video_avcc->time_base;&#xA;&#xA;    &#xA;&#xA;    if (avcodec_open2(encoder_sc->video_avcc, encoder_sc->video_avc, NULL) &lt; 0)&#xA;    {&#xA;        logging("Could not open the Codec.");&#xA;        return -1;&#xA;    }&#xA;    avcodec_parameters_from_context(encoder_sc->video_avs->codecpar, encoder_sc->video_avcc);&#xA;    return 0;&#xA;}&#xA;&#xA;&#xA;int prepare_copy(AVFormatContext *avfc, AVStream **avs, AVCodecParameters *decoder_par)&#xA;{&#xA;    *avs = avformat_new_stream(avfc, NULL);&#xA;    avcodec_parameters_copy((*avs)->codecpar, decoder_par);&#xA;    return 0;&#xA;}&#xA;&#xA;int encode_video(StreamingContext *decoder, StreamingContext *encoder, AVFrame *input_frame)&#xA;{&#xA;    if (input_frame)&#xA;        input_frame->pict_type = AV_PICTURE_TYPE_NONE;&#xA;&#xA;    AVPacket *output_packet = av_packet_alloc();&#xA;&#xA;&#xA;    int response = avcodec_send_frame(encoder->video_avcc, input_frame);&#xA;&#xA;    while (response >= 0)&#xA;    {&#xA;        response = avcodec_receive_packet(encoder->video_avcc, output_packet);&#xA;        if (response == AVERROR(EAGAIN) || response == AVERROR_EOF)&#xA;        {&#xA;            break;&#xA;        }&#xA;&#xA;        output_packet->stream_index = decoder->video_index;&#xA;        output_packet->duration = encoder->video_avs->time_base.den / encoder->video_avs->time_base.num;&#xA;&#xA;        av_packet_rescale_ts(output_packet, decoder->video_avs->time_base, encoder->video_avs->time_base);&#xA;        response = av_interleaved_write_frame(encoder->avfc, output_packet);&#xA;    }&#xA;&#xA;    av_packet_unref(output_packet);&#xA;    av_packet_free(&amp;output_packet);&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;int remux(AVPacket **pkt, AVFormatContext **avfc, AVRational decoder_tb, AVRational encoder_tb)&#xA;{&#xA;    (*pkt)->duration = av_rescale_q((*pkt)->duration, decoder_tb, encoder_tb);&#xA;    (*pkt)->pos = -1;&#xA;    av_packet_rescale_ts(*pkt, decoder_tb, encoder_tb);&#xA;    if (av_interleaved_write_frame(*avfc, *pkt) &lt; 0)&#xA;    {&#xA;        logging("Error while copying Stream Packet.");&#xA;        return -1;&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;int transcode_video(StreamingContext *decoder, StreamingContext *encoder, AVPacket *input_packet, AVFrame *input_frame)&#xA;{&#xA;    int response = avcodec_send_packet(decoder->video_avcc, input_packet);&#xA;    while (response >= 0)&#xA;    {&#xA;        response = avcodec_receive_frame(decoder->video_avcc, input_frame);&#xA;        &#xA;        if (response == AVERROR(EAGAIN) || response == AVERROR_EOF)&#xA;        {&#xA;            break;&#xA;        }&#xA;        if (response >= 0)&#xA;        {&#xA;            if (encode_video(decoder, encoder, input_frame))&#xA;                return -1;&#xA;        }&#xA;&#xA;        av_frame_unref(input_frame);&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;int main(int argc, char *argv[])&#xA;{&#xA;    const int scaled_frame_width = 854;&#xA;    const int scaled_frame_height = 480;&#xA;    StreamingParams sp = {0};&#xA;    sp.copy_audio = 1;&#xA;    sp.copy_video = 0;&#xA;    sp.video_codec = "libsvtav1";&#xA;    &#xA;    StreamingContext *decoder = (StreamingContext *)calloc(1, sizeof(StreamingContext));&#xA;    decoder->filename = "rtsp://localhost:8554/mystream";&#xA;&#xA;    StreamingContext *encoder = (StreamingContext *)calloc(1, sizeof(StreamingContext));&#xA;    encoder->filename = "small_bunny_9.mp4";&#xA;    &#xA;    if (sp.output_extension)&#xA;    {&#xA;        strcat(encoder->filename, sp.output_extension);&#xA;    }&#xA;&#xA;    open_media(decoder->filename, &amp;decoder->avfc);&#xA;    prepare_decoder(decoder);&#xA;&#xA;&#xA;    avformat_alloc_output_context2(&amp;encoder->avfc, NULL, "mp4", encoder->filename);&#xA;    AVRational input_framerate = av_guess_frame_rate(decoder->avfc, decoder->video_avs, NULL);&#xA;    prepare_video_encoder(encoder, decoder->video_avcc, input_framerate, sp, scaled_frame_width, scaled_frame_height);&#xA;&#xA;    prepare_copy(encoder->avfc, &amp;encoder->audio_avs, decoder->audio_avs->codecpar);&#xA;        &#xA;&#xA;    if (encoder->avfc->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        encoder->avfc->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;    if (!(encoder->avfc->oformat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        if (avio_open(&amp;encoder->avfc->pb, encoder->filename, AVIO_FLAG_WRITE) &lt; 0)&#xA;        {&#xA;            logging("could not open the output file");&#xA;            return -1;&#xA;        }&#xA;    }&#xA;&#xA;    &#xA;    if (avformat_write_header(encoder->avfc, NULL) &lt; 0)&#xA;    {&#xA;        logging("an error occurred when opening output file");&#xA;        return -1;&#xA;    }&#xA;&#xA;    AVFrame *input_frame = av_frame_alloc();&#xA;    AVPacket *input_packet = av_packet_alloc();&#xA;&#xA;    while (1)&#xA;    {&#xA;        int ret = av_read_frame(decoder->avfc, input_packet);&#xA;        if(ret&lt;0)&#xA;            break;&#xA;        if (decoder->avfc->streams[input_packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;        {&#xA;            if (transcode_video(decoder, encoder, input_packet, input_frame))&#xA;                return -1;&#xA;            av_packet_unref(input_packet);&#xA;&#xA;        }&#xA;        else if (decoder->avfc->streams[input_packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)&#xA;        {&#xA;            &#xA;                if (remux(&amp;input_packet, &amp;encoder->avfc, decoder->audio_avs->time_base, encoder->audio_avs->time_base))&#xA;                    return -1;&#xA;        }&#xA;        else&#xA;        {&#xA;            logging("Ignoring all nonvideo or audio packets.");&#xA;        }&#xA;    }&#xA;&#xA;    if (encode_video(decoder, encoder, NULL))&#xA;        return -1;&#xA;    &#xA;&#xA;    av_write_trailer(encoder->avfc);&#xA;&#xA;&#xA;    if (input_frame != NULL)&#xA;    {&#xA;        av_frame_free(&amp;input_frame);&#xA;        input_frame = NULL;&#xA;    }&#xA;&#xA;    if (input_packet != NULL)&#xA;    {&#xA;        av_packet_free(&amp;input_packet);&#xA;        input_packet = NULL;&#xA;    }&#xA;&#xA;    avformat_close_input(&amp;decoder->avfc);&#xA;&#xA;    avformat_free_context(decoder->avfc);&#xA;    decoder->avfc = NULL;&#xA;    avformat_free_context(encoder->avfc);&#xA;    encoder->avfc = NULL;&#xA;&#xA;    avcodec_free_context(&amp;decoder->video_avcc);&#xA;    decoder->video_avcc = NULL;&#xA;    avcodec_free_context(&amp;decoder->audio_avcc);&#xA;    decoder->audio_avcc = NULL;&#xA;&#xA;    free(decoder);&#xA;    decoder = NULL;&#xA;    free(encoder);&#xA;    encoder = NULL;&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;

    &#xA;

  • How to modify the bit_rate of AVFormatContext ?

    27 mars 2023, par Zion Liu

    Hello,I would like to know how to modify the bit_rate of AVFormatContext.

    &#xA;

    Here is the minimal reproducible example.This is a simple process for pushing rtmp video streams.Now I want to control the bitrate of the video it pushes.

    &#xA;

    I tried modifying the bitrate like this, but it didn't work.

    &#xA;

    AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;&#xA;int64_t bit_rate = 400*1000;&#xA;....&#xA;ofmt_ctx->bit_rate = bit_rate;&#xA;

    &#xA;

    Can be compiled by g&#x2B;&#x2B; -Wall -o -g -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include -L/usr/local/lib  simplt_push_streaming.cpp -o test.out -lavformat -lavcodec -lavutil -lgobject-2.0 -lglib-2.0 -lpthread

    &#xA;

    And my ffmpeg version : ffmpeg version 4.4.2-0ubuntu0.22.04.1

    &#xA;

    #include &#xA;extern "C"&#xA;{&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>mathematics.h>&#xA;#include <libavutil></libavutil>time.h>&#xA;};&#xA;&#xA;int main(int argc, char* argv[])&#xA;{&#xA;    AVOutputFormat *ofmt = NULL;&#xA;    //Input AVFormatContext and Output AVFormatContext&#xA;    AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;&#xA;    AVPacket pkt;&#xA;    const char *in_filename, *out_filename;&#xA;    int ret, i;&#xA;    int videoindex=-1;&#xA;    int frame_index=0;&#xA;    int64_t start_time=0;&#xA;    int64_t bit_rate = 400*1000;&#xA;    in_filename  = "/home/zion/video/mecha.flv";// Input file URL&#xA;    out_filename = "rtmp://localhost:1935/live/test";//Output URL [RTMP]&#xA;    av_register_all();&#xA;    avformat_network_init();&#xA;    avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0);&#xA;    avformat_find_stream_info(ifmt_ctx, 0);&#xA;    for(i=0; inb_streams; i&#x2B;&#x2B;) &#xA;        if(ifmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO){&#xA;            videoindex=i;&#xA;            break;&#xA;        }&#xA;    //Output&#xA;    avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, "flv", out_filename); //RTMP&#xA;    ofmt = ofmt_ctx->oformat;&#xA;    for (i = 0; i &lt; ifmt_ctx->nb_streams; i&#x2B;&#x2B;) {&#xA;        //Create output AVStream according to input AVStream&#xA;        AVStream *in_stream = ifmt_ctx->streams[i];&#xA;        AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);&#xA;        //Copy the settings of AVCodecContext&#xA;        ret = avcodec_copy_context(out_stream->codec, in_stream->codec);&#xA;        out_stream->codec->codec_tag = 0;&#xA;        if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;            out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    }&#xA;    //Open output URL&#xA;    if (!(ofmt->flags &amp; AVFMT_NOFILE)) {&#xA;        ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);&#xA;    }&#xA;    //Write file header&#xA;    avformat_write_header(ofmt_ctx, NULL);&#xA;    start_time=av_gettime();&#xA;    while (1) {&#xA;        AVStream *in_stream, *out_stream;&#xA;        //Get an AVPacket&#xA;        ret = av_read_frame(ifmt_ctx, &amp;pkt);&#xA;        if (ret &lt; 0)&#xA;            break;&#xA;        //Important:Delay&#xA;        if(pkt.stream_index==videoindex){&#xA;            AVRational time_base=ifmt_ctx->streams[videoindex]->time_base;&#xA;            AVRational time_base_q={1,AV_TIME_BASE};&#xA;            int64_t pts_time = av_rescale_q(pkt.dts, time_base, time_base_q);&#xA;            int64_t now_time = av_gettime() - start_time;&#xA;            if (pts_time > now_time)&#xA;                av_usleep(pts_time - now_time);&#xA;        }&#xA;        in_stream  = ifmt_ctx->streams[pkt.stream_index];&#xA;        out_stream = ofmt_ctx->streams[pkt.stream_index];&#xA;        if(pkt.stream_index==videoindex){&#xA;            printf("Send %8d video frames to output URL\n",frame_index);&#xA;            frame_index&#x2B;&#x2B;;&#xA;        }&#xA;/*I tried modifying the bitrate here and I&#x27;m not sure if this is the correct usage.*/&#xA;        ofmt_ctx->bit_rate = bit_rate;&#xA;        av_interleaved_write_frame(ofmt_ctx, &amp;pkt);&#xA;        av_free_packet(&amp;pkt);&#xA;    }&#xA;    //Write file trailer&#xA;    av_write_trailer(ofmt_ctx);&#xA;end:&#xA;    avformat_close_input(&amp;ifmt_ctx);&#xA;    /* close output */&#xA;    if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))&#xA;        avio_close(ofmt_ctx->pb);&#xA;    avformat_free_context(ofmt_ctx);&#xA;    return 0;&#xA;}&#xA;

    &#xA;

  • Puzzled with file descriptor in Bash (ffmpeg video capture)

    3 mai 2020, par ChrisAga

    I am trying to use file descriptors in Bash and found a problem I cannot solve.&#xA;I have to read a video stream coming from the standard output of a command executed in a coproc. This piece of code works as expected :

    &#xA;&#xA;

    ffmpeg \&#xA;    -i &lt;(exec cat &lt;&amp;${COPROC[0]}) \&#xA;    -c:v $ENCODE_VIDEO_FORMAT_LOSSLESS $ENCODE_VIDEO_OPTIONS_LOSSLESS \&#xA;    -c:a copy \&#xA;    -progress /dev/fd/1 \&#xA;    "${capfile}"&#xA;

    &#xA;&#xA;

    But the cat process is not really useful since ffmpeg -i pipe:<file descriptor="descriptor"></file> seems to do the same. So I tried the following code which fails with pipe:63: Bad file descriptor&#xA; error.

    &#xA;&#xA;

    ffmpeg \&#xA;    -i pipe:"${COPROC[0]}" \&#xA;    -c:v $ENCODE_VIDEO_FORMAT_LOSSLESS $ENCODE_VIDEO_OPTIONS_LOSSLESS \&#xA;    -c:a copy \&#xA;    -progress /dev/fd/1 \&#xA;    "${capfile}"&#xA;

    &#xA;&#xA;

    The actual script is something a bit complicated but here is a minimal testing code for this issue :

    &#xA;&#xA;

    #!/bin/bash&#xA;#&#xA;&#xA;ENCODE_VIDEO_FORMAT_LOSSLESS=ffv1&#xA;ENCODE_VIDEO_OPTIONS_LOSSLESS="-level 3 -threads 7 -coder 1 -context 1 -g 1 -slices 30 -slicecrc 1"&#xA;&#xA;capfile=capure.mkv&#xA;&#xA;coproc ffmpeg  -i file:&#x27;Camomille.mkv&#x27; -c:v copy -c:a copy -f matroska pipe:1&#xA;&#xA;capture_fd=${COPROC[0]}&#xA;echo "hk_capture_pid=${COPROC_PID}"&#xA;&#xA;ffmpeg \&#xA;    -i pipe:${COPROC[0]} \&#xA;    -c:v $ENCODE_VIDEO_FORMAT_LOSSLESS $ENCODE_VIDEO_OPTIONS_LOSSLESS \&#xA;    -c:a copy \&#xA;    -progress /dev/fd/1 \&#xA;    "${capfile}"&#xA;

    &#xA;&#xA;

    This is the output of the second ffmpeg command :

    &#xA;&#xA;

    ffmpeg version 4.1.4-1build2 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.2.1-4ubuntu1)&#xA;  configuration: --prefix=/usr --extra-version=1build2 --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 22.100 / 56. 22.100&#xA;  libavcodec     58. 35.100 / 58. 35.100&#xA;  libavformat    58. 20.100 / 58. 20.100&#xA;  libavdevice    58.  5.100 / 58.  5.100&#xA;  libavfilter     7. 40.101 /  7. 40.101&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  3.100 /  5.  3.100&#xA;  libswresample   3.  3.100 /  3.  3.100&#xA;  libpostproc    55.  3.100 / 55.  3.100&#xA;pipe:63: Bad file descriptor&#xA;av_interleaved_write_frame(): Broken pipe                                                                                       &#xA;Error writing trailer of pipe:1: Broken pipe                                                                                    &#xA;frame=    4 fps=0.0 q=-1.0 Lsize=      48kB time=00:00:00.03 bitrate=10051.1kbits/s speed=3.44x    &#xA;video:86kB audio:1kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: unknown&#xA;Conversion failed!&#xA;

    &#xA;&#xA;

    This one fails and if you replace -i pipe:${COPROC[0]} by -i &lt;(exec cat &lt;&amp;${COPROC[0]}) a capture.mkv file is created.

    &#xA;&#xA;

    I run ubuntu eoan and bash version is : GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu). I upgraded several times since I started with this issue, so it wouldn't be related too much to bash and ffmpeg versions.

    &#xA;&#xA;

    If someone can point me to what I do wrong with bash file descriptors I would be grateful.

    &#xA;