Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (57)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (6705)

  • Encoding .png images with h264 to a file on disk

    21 février 2021, par xyfix

    Can somebody help me to find out why I end up with a file on disk that is only 24 kb and not readable by vlc or so, while I send valid YUV images to the codec. I have added the .h and .cpp file. Up till "avcodec_receive_packet" everything seems to be OK. The function call "avcodec_send_frame" returns 0, so that must be OK but "avcodec_receive_packet" returns -11. If I flush the encoder (currently commented) then "avcodec_receive_packet" returns 0 and I can see encoded data if I store it on disk. Also the input image to the encoder is also correct (currently commented) and checked. I'm aiming for an intra-frame encoding, so I should get the encoded frame data back, but I don't get anything back even if I send 24 images to it.

    


    .h file

    


    #ifndef MOVIECODEC_H
#define MOVIECODEC_H

#include 

extern "C"
{
    #include "Codec/include/libavcodec/avcodec.h"
    #include "Codec/include/libavdevice/avdevice.h"
    #include "Codec/include/libavformat/avformat.h"
    #include "Codec/include/libavutil/avutil.h"
    #include "Codec/include/libavutil/imgutils.h"
    #include "Codec/include/libswscale/swscale.h"
}


class MovieCodec
{
public:

    MovieCodec(const char *filename);

    ~MovieCodec();

    void encodeImage( const cv::Mat& image );

    void close();
    
private :

    void add_stream();

    void openVideoCodec();

    void write_video_frame(const cv::Mat& image);

    void createFrame( const cv::Mat& image );

private:

    static int s_frameCount;

    int m_timeVideo = 0;

    std::string m_filename;

    FILE* m_file;

    AVCodec* m_encoder = NULL;

    AVOutputFormat* m_outputFormat = NULL;

    AVFormatContext* m_formatCtx = NULL;

    AVCodecContext* m_codecCtx = NULL;

    AVStream* m_streamOut = NULL;

    AVFrame* m_frame = NULL;

    AVPacket* m_packet = NULL;

};


    


    .cpp file

    


    #ifndef MOVIECODEC_CPP
#define MOVIECODEC_CPP

#include "moviecodec.h"


#define STREAM_DURATION   5.0
#define STREAM_FRAME_RATE 24
#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
#define STREAM_PIX_FMT    AV_PIX_FMT_YUV420P /* default pix_fmt */


static int sws_flags = SWS_BICUBIC;
int MovieCodec::s_frameCount = 0;

MovieCodec::MovieCodec( const char* filename ) :
    m_filename( filename ),
    m_encoder( avcodec_find_encoder( AV_CODEC_ID_H264 ))
{
    av_log_set_level(AV_LOG_VERBOSE);

    int ret(0);

    m_file = fopen( m_filename.c_str(), "wb");

    // allocate the output media context
    ret = avformat_alloc_output_context2( &m_formatCtx, m_outputFormat, NULL, m_filename.c_str());

    if (!m_formatCtx)
        return;

    m_outputFormat = m_formatCtx->oformat;

    // Add the video stream using H264 codec
    add_stream();

    // Open video codec and allocate the necessary encode buffers
    if (m_streamOut)
        openVideoCodec();

    av_dump_format( m_formatCtx, 0, m_filename.c_str(), 1);

    // Open the output media file, if needed
    if (!( m_outputFormat->flags & AVFMT_NOFILE))
    {
        ret = avio_open( &m_formatCtx->pb, m_filename.c_str(), AVIO_FLAG_WRITE);

        if (ret < 0)
        {
            char error[255];
            ret = av_strerror( ret, error, 255);
            fprintf(stderr, "Could not open '%s': %s\n", m_filename.c_str(), error);
            return ;
        }
    }
    else
    {
        return;
    }

    m_formatCtx->flush_packets = 1;

    ret = avformat_write_header( m_formatCtx, NULL );

    if (ret < 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Error occurred when opening output file: %s\n", error);
        return;
    }


    if ( m_frame )
           m_frame->pts = 0;
}



MovieCodec::~MovieCodec()
{
    close();
}



void MovieCodec::encodeImage(const cv::Mat &image)
{
    // Compute video time from last added video frame
    m_timeVideo = (double)m_frame->pts) * av_q2d(m_streamOut->time_base);

    // Stop media if enough time
    if (!m_streamOut /*|| m_timeVideo >= STREAM_DURATION*/)
       return;

    // Add a video frame
    write_video_frame( image );

    // Increase frame pts according to time base
    m_frame->pts += av_rescale_q(1, m_codecCtx->time_base, m_streamOut->time_base);
}


void MovieCodec::close()
{
    int ret( 0 );

    // Write media trailer
//    if( m_formatCtx )
//        ret = av_write_trailer( m_formatCtx );

    /* flush the encoder */
    ret = avcodec_send_frame(m_codecCtx, NULL);

    /* Close each codec. */
    if ( m_streamOut )
    {
        av_free( m_frame->data[0]);
        av_free( m_frame );
    }

    if (!( m_outputFormat->flags & AVFMT_NOFILE))
        /* Close the output file. */
        ret = avio_close( m_formatCtx->pb);


    /* free the stream */
    avformat_free_context( m_formatCtx );

    fflush( m_file );
}


void MovieCodec::createFrame( const cv::Mat& image )
{
    /**
     * \note allocate frame
     */
    m_frame = av_frame_alloc();
    m_frame->format = STREAM_PIX_FMT;
    m_frame->width = image.cols();
    m_frame->height = image.rows();
    m_frame->pict_type = AV_PICTURE_TYPE_I;
    int ret = av_image_alloc(m_frame->data, m_frame->linesize, m_frame->width,  m_frame->height, STREAM_PIX_FMT, 1);

    if (ret < 0)
    {
        return;
    }

    struct SwsContext* sws_ctx = sws_getContext((int)image.cols(), (int)image.rows(), AV_PIX_FMT_RGB24,
                                                (int)image.cols(), (int)image.rows(), STREAM_PIX_FMT, 0, NULL, NULL, NULL);

    const uint8_t* rgbData[1] = { (uint8_t* )image.getData() };
    int rgbLineSize[1] = { 3 * image.cols() };

    sws_scale(sws_ctx, rgbData, rgbLineSize, 0, image.rows(), m_frame->data, m_frame->linesize);
}


/* Add an output stream. */
void MovieCodec::add_stream()
{
    AVCodecID codecId = AV_CODEC_ID_H264;

    if (!( m_encoder ))
    {
        fprintf(stderr, "Could not find encoder for '%s'\n",
            avcodec_get_name(codecId));
        return;
    }

    // Get the stream for codec
    m_streamOut = avformat_new_stream(m_formatCtx, m_encoder);

    if (!m_streamOut) {
        fprintf(stderr, "Could not allocate stream\n");
        return;
    }

    m_streamOut->id = m_formatCtx->nb_streams - 1;

    m_codecCtx = avcodec_alloc_context3( m_encoder);

    m_streamOut->codecpar->codec_id = codecId;
    m_streamOut->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
    m_streamOut->codecpar->bit_rate = 400000;
    m_streamOut->codecpar->width = 800;
    m_streamOut->codecpar->height = 640;
    m_streamOut->codecpar->format = STREAM_PIX_FMT;
    m_streamOut->codecpar->codec_tag = 0x31637661;
    m_streamOut->codecpar->video_delay = 0;
    m_streamOut->time_base = { 1, STREAM_FRAME_RATE };


    avcodec_parameters_to_context( m_codecCtx, m_streamOut->codecpar);
    
    m_codecCtx->gop_size = 0; /* emit one intra frame every twelve frames at most */
    m_codecCtx->max_b_frames = 0;
    m_codecCtx->time_base = { 1, STREAM_FRAME_RATE };
    m_codecCtx->framerate = { STREAM_FRAME_RATE, 1 };
    m_codecCtx->pix_fmt = STREAM_PIX_FMT;



    if (m_streamOut->codecpar->codec_id == AV_CODEC_ID_H264)
    {
      av_opt_set( m_codecCtx, "preset", "ultrafast", 0 );
      av_opt_set( m_codecCtx, "vprofile", "baseline", 0 );
      av_opt_set( m_codecCtx, "tune", "zerolatency", 0 );
    }

//    /* Some formats want stream headers to be separate. */
//    if (m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
//            m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;


}


void MovieCodec::openVideoCodec()
{
    int ret;

    /* open the codec */
    ret = avcodec_open2(m_codecCtx, m_encoder, NULL);

    if (ret < 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Could not open video codec: %s\n", error);
    }
}



void MovieCodec::write_video_frame( const cv::Mat& image )
{
    int ret;

    createFrame( image );


    if (m_formatCtx->oformat->flags & 0x0020 )
    {
        /* Raw video case - directly store the picture in the packet */
        AVPacket pkt;
        av_init_packet(&pkt);

        pkt.flags |= AV_PKT_FLAG_KEY;
        pkt.stream_index = m_streamOut->index;
        pkt.data = m_frame->data[0];
        pkt.size = sizeof(AVPicture);

//        ret = av_interleaved_write_frame(m_formatCtx, &pkt);
        ret = av_write_frame( m_formatCtx, &pkt );
    }
    else
    {
        AVPacket pkt;
        av_init_packet(&pkt);

        /* encode the image */

//cv::Mat yuv420p( m_frame->height + m_frame->height/2, m_frame->width, CV_8UC1, m_frame->data[0]);
//cv::Mat cvmIm;
//cv::cvtColor(yuv420p,cvmIm,CV_YUV420p2BGR);
//cv::imwrite("c:\\tmp\\YUVoriginal.png", cvmIm);

        ret = avcodec_send_frame(m_codecCtx, m_frame);

        if (ret < 0)
        {
            char error[255];
            av_strerror(ret, error, 255);
            fprintf(stderr, "Error encoding video frame: %s\n", error);
            return;
        }

        /* If size is zero, it means the image was buffered. */
//        ret = avcodec_receive_packet(m_codecCtx, &pkt);

        do
        {
            ret = avcodec_receive_packet(m_codecCtx, &pkt);

            if (ret == 0)
            {
                ret = av_write_frame( m_formatCtx, &pkt );
                av_packet_unref(&pkt);

                break;
            }
//            else if ((ret < 0) && (ret != AVERROR(EAGAIN)))
//            {
//                return;
//            }
//            else if (ret == AVERROR(EAGAIN))
//            {
//                /* flush the encoder */
//                ret = avcodec_send_frame(m_codecCtx, NULL);
//
//                if (0 > ret)
//                    return;
//            }
        } while (ret == 0);

        if( !ret && pkt.size)
        {
            pkt.stream_index = m_streamOut->index;

            /* Write the compressed frame to the media file. */
//            ret = av_interleaved_write_frame(m_formatCtx, &pkt);
            ret = av_write_frame( m_formatCtx, &pkt );
        }
        else
        {
            ret = 0;
        }
    }

    if (ret != 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Error while writing video frame: %s\n", error);
        return;
    }

    s_frameCount++;
}


    


  • Encoding .png images with h264 to a file on disk

    19 février 2021, par xyfix

    Can somebody help me to find out why I end up with a file on disk that is only 24 kb and not readable by vlc or so, while I send valid YUV images to the codec. I have added the .h and .cpp file. Up till "avcodec_receive_packet" everything seems to be OK. The function call "avcodec_send_frame" returns 0, so that must be OK but "avcodec_receive_packet" returns -11. If I flush the encoder (currently commented) then "avcodec_receive_packet" returns 0 and I can see encoded data if I store it on disk. Also the input image to the encoder is also correct (currently commented) and checked. I'm aiming for an intra-frame encoding, so I should get the encoded frame data back, but I don't get anything back even if I send 24 images to it.

    


    .h file

    


    #ifndef MOVIECODEC_H
#define MOVIECODEC_H

#include 

extern "C"
{
    #include "Codec/include/libavcodec/avcodec.h"
    #include "Codec/include/libavdevice/avdevice.h"
    #include "Codec/include/libavformat/avformat.h"
    #include "Codec/include/libavutil/avutil.h"
    #include "Codec/include/libavutil/imgutils.h"
    #include "Codec/include/libswscale/swscale.h"
}


class MovieCodec
{
public:

    MovieCodec(const char *filename);

    ~MovieCodec();

    void encodeImage( const cv::Mat& image );

    void close();
    
private :

    void add_stream();

    void openVideoCodec();

    void write_video_frame(const cv::Mat& image);

    void createFrame( const cv::Mat& image );

private:

    static int s_frameCount;

    int m_timeVideo = 0;

    std::string m_filename;

    FILE* m_file;

    AVCodec* m_encoder = NULL;

    AVOutputFormat* m_outputFormat = NULL;

    AVFormatContext* m_formatCtx = NULL;

    AVCodecContext* m_codecCtx = NULL;

    AVStream* m_streamOut = NULL;

    AVFrame* m_frame = NULL;

    AVPacket* m_packet = NULL;

};


    


    .cpp file

    


    #ifndef MOVIECODEC_CPP
#define MOVIECODEC_CPP

#include "moviecodec.h"


#define STREAM_DURATION   5.0
#define STREAM_FRAME_RATE 24
#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
#define STREAM_PIX_FMT    AV_PIX_FMT_YUV420P /* default pix_fmt */


static int sws_flags = SWS_BICUBIC;
int MovieCodec::s_frameCount = 0;

MovieCodec::MovieCodec( const char* filename ) :
    m_filename( filename ),
    m_encoder( avcodec_find_encoder( AV_CODEC_ID_H264 ))
{
    av_log_set_level(AV_LOG_VERBOSE);

    int ret(0);

    m_file = fopen( m_filename.c_str(), "wb");

    // allocate the output media context
    ret = avformat_alloc_output_context2( &m_formatCtx, m_outputFormat, NULL, m_filename.c_str());

    if (!m_formatCtx)
        return;

    m_outputFormat = m_formatCtx->oformat;

    // Add the video stream using H264 codec
    add_stream();

    // Open video codec and allocate the necessary encode buffers
    if (m_streamOut)
        openVideoCodec();

    av_dump_format( m_formatCtx, 0, m_filename.c_str(), 1);

    // Open the output media file, if needed
    if (!( m_outputFormat->flags & AVFMT_NOFILE))
    {
        ret = avio_open( &m_formatCtx->pb, m_filename.c_str(), AVIO_FLAG_WRITE);

        if (ret < 0)
        {
            char error[255];
            ret = av_strerror( ret, error, 255);
            fprintf(stderr, "Could not open '%s': %s\n", m_filename.c_str(), error);
            return ;
        }
    }
    else
    {
        return;
    }

    m_formatCtx->flush_packets = 1;

    ret = avformat_write_header( m_formatCtx, NULL );

    if (ret < 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Error occurred when opening output file: %s\n", error);
        return;
    }


    if ( m_frame )
           m_frame->pts = 0;
}



MovieCodec::~MovieCodec()
{
    close();
}



void MovieCodec::encodeImage(const cv::Mat &image)
{
    // Compute video time from last added video frame
    m_timeVideo = (double)m_frame->pts) * av_q2d(m_streamOut->time_base);

    // Stop media if enough time
    if (!m_streamOut /*|| m_timeVideo >= STREAM_DURATION*/)
       return;

    // Add a video frame
    write_video_frame( image );

    // Increase frame pts according to time base
    m_frame->pts += av_rescale_q(1, m_codecCtx->time_base, m_streamOut->time_base);
}


void MovieCodec::close()
{
    int ret( 0 );

    // Write media trailer
//    if( m_formatCtx )
//        ret = av_write_trailer( m_formatCtx );

    /* flush the encoder */
    ret = avcodec_send_frame(m_codecCtx, NULL);

    /* Close each codec. */
    if ( m_streamOut )
    {
        av_free( m_frame->data[0]);
        av_free( m_frame );
    }

    if (!( m_outputFormat->flags & AVFMT_NOFILE))
        /* Close the output file. */
        ret = avio_close( m_formatCtx->pb);


    /* free the stream */
    avformat_free_context( m_formatCtx );

    fflush( m_file );
}


void MovieCodec::createFrame( const cv::Mat& image )
{
    /**
     * \note allocate frame
     */
    m_frame = av_frame_alloc();
    m_frame->format = STREAM_PIX_FMT;
    m_frame->width = image.cols();
    m_frame->height = image.rows();
    m_frame->pict_type = AV_PICTURE_TYPE_I;
    int ret = av_image_alloc(m_frame->data, m_frame->linesize, m_frame->width,  m_frame->height, STREAM_PIX_FMT, 1);

    if (ret < 0)
    {
        return;
    }

    struct SwsContext* sws_ctx = sws_getContext((int)image.cols(), (int)image.rows(), AV_PIX_FMT_RGB24,
                                                (int)image.cols(), (int)image.rows(), STREAM_PIX_FMT, 0, NULL, NULL, NULL);

    const uint8_t* rgbData[1] = { (uint8_t* )image.getData() };
    int rgbLineSize[1] = { 3 * image.cols() };

    sws_scale(sws_ctx, rgbData, rgbLineSize, 0, image.rows(), m_frame->data, m_frame->linesize);
}


/* Add an output stream. */
void MovieCodec::add_stream()
{
    AVCodecID codecId = AV_CODEC_ID_H264;

    if (!( m_encoder ))
    {
        fprintf(stderr, "Could not find encoder for '%s'\n",
            avcodec_get_name(codecId));
        return;
    }

    // Get the stream for codec
    m_streamOut = avformat_new_stream(m_formatCtx, m_encoder);

    if (!m_streamOut) {
        fprintf(stderr, "Could not allocate stream\n");
        return;
    }

    m_streamOut->id = m_formatCtx->nb_streams - 1;

    m_codecCtx = avcodec_alloc_context3( m_encoder);

    m_streamOut->codecpar->codec_id = codecId;
    m_streamOut->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
    m_streamOut->codecpar->bit_rate = 400000;
    m_streamOut->codecpar->width = 800;
    m_streamOut->codecpar->height = 640;
    m_streamOut->codecpar->format = STREAM_PIX_FMT;
    m_streamOut->codecpar->codec_tag = 0x31637661;
    m_streamOut->codecpar->video_delay = 0;
    m_streamOut->time_base = { 1, STREAM_FRAME_RATE };


    avcodec_parameters_to_context( m_codecCtx, m_streamOut->codecpar);
    
    m_codecCtx->gop_size = 0; /* emit one intra frame every twelve frames at most */
    m_codecCtx->max_b_frames = 0;
    m_codecCtx->time_base = { 1, STREAM_FRAME_RATE };
    m_codecCtx->framerate = { STREAM_FRAME_RATE, 1 };
    m_codecCtx->pix_fmt = STREAM_PIX_FMT;



    if (m_streamOut->codecpar->codec_id == AV_CODEC_ID_H264)
    {
      av_opt_set( m_codecCtx, "preset", "ultrafast", 0 );
      av_opt_set( m_codecCtx, "vprofile", "baseline", 0 );
      av_opt_set( m_codecCtx, "tune", "zerolatency", 0 );
    }

//    /* Some formats want stream headers to be separate. */
//    if (m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
//            m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;


}


void MovieCodec::openVideoCodec()
{
    int ret;

    /* open the codec */
    ret = avcodec_open2(m_codecCtx, m_encoder, NULL);

    if (ret < 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Could not open video codec: %s\n", error);
    }
}



void MovieCodec::write_video_frame( const cv::Mat& image )
{
    int ret;

    createFrame( image );


    if (m_formatCtx->oformat->flags & 0x0020 )
    {
        /* Raw video case - directly store the picture in the packet */
        AVPacket pkt;
        av_init_packet(&pkt);

        pkt.flags |= AV_PKT_FLAG_KEY;
        pkt.stream_index = m_streamOut->index;
        pkt.data = m_frame->data[0];
        pkt.size = sizeof(AVPicture);

//        ret = av_interleaved_write_frame(m_formatCtx, &pkt);
        ret = av_write_frame( m_formatCtx, &pkt );
    }
    else
    {
        AVPacket pkt;
        av_init_packet(&pkt);

        /* encode the image */

//cv::Mat yuv420p( m_frame->height + m_frame->height/2, m_frame->width, CV_8UC1, m_frame->data[0]);
//cv::Mat cvmIm;
//cv::cvtColor(yuv420p,cvmIm,CV_YUV420p2BGR);
//cv::imwrite("c:\\tmp\\YUVoriginal.png", cvmIm);

        ret = avcodec_send_frame(m_codecCtx, m_frame);

        if (ret < 0)
        {
            char error[255];
            av_strerror(ret, error, 255);
            fprintf(stderr, "Error encoding video frame: %s\n", error);
            return;
        }

        /* If size is zero, it means the image was buffered. */
//        ret = avcodec_receive_packet(m_codecCtx, &pkt);

        do
        {
            ret = avcodec_receive_packet(m_codecCtx, &pkt);

            if (ret == 0)
            {
                ret = av_write_frame( m_formatCtx, &pkt );
                av_packet_unref(&pkt);

                break;
            }
//            else if ((ret < 0) && (ret != AVERROR(EAGAIN)))
//            {
//                return;
//            }
//            else if (ret == AVERROR(EAGAIN))
//            {
//                /* flush the encoder */
//                ret = avcodec_send_frame(m_codecCtx, NULL);
//
//                if (0 > ret)
//                    return;
//            }
        } while (ret == 0);

        if( !ret && pkt.size)
        {
            pkt.stream_index = m_streamOut->index;

            /* Write the compressed frame to the media file. */
//            ret = av_interleaved_write_frame(m_formatCtx, &pkt);
            ret = av_write_frame( m_formatCtx, &pkt );
        }
        else
        {
            ret = 0;
        }
    }

    if (ret != 0)
    {
        char error[255];
        av_strerror(ret, error, 255);
        fprintf(stderr, "Error while writing video frame: %s\n", error);
        return;
    }

    s_frameCount++;
}


    


  • No accelerated colorspace conversion found from yuv420p to argb

    13 mars, par Zac Chan

    I am a novice at ffmpeg and have recently taken over a code base built by a previous engineer. The FFmpeg code is on an app engine that will edit the videos when they are uploaded.

    


    This code generated a title animation that will later be used as an overlay.

    


    exports.generateTitleAnimation = function(metadata, destPath, options = {}) {
const peeqLogoPath = "/app/assets/peeq-logo.png";
const whiteBarMovPath = "/app/assets/whiteBar.mov";
const titleFontPath = "/app/assets/Sofia-Pro-Black.otf";
const dateStrFontPath = "/app/assets/Sofia-Pro-Medium.otf";
const outputDuration = 5.52;
const src01 = "color=c=white:s=1920x1080:duration=" + outputDuration;
const src02 = "color=c=white@0.0:s=1920x1080:r=120:duration=" + outputDuration;

var dateStrXOffset = "(92";
var filterComplexStr = "[1]";

if (metadata.title) {
    const title = metadata.title.toUpperCase();
    filterComplexStr += "drawtext=fontfile=" + titleFontPath + ":text='" + title + "':x='floor(92*(min((t-1.75)^29,0)+max((t-3.75)^29,0)+1))':y=622+30+2:fontsize=70:fontcolor=black:ft_load_flags=render,";
}
if (metadata.subTitle) {
    const subTitle = metadata.subTitle.toUpperCase();
    filterComplexStr += "drawtext=fontfile=" + titleFontPath + ":text='" + subTitle + "':x='floor(92*(min((t-2.0)^29,0.0)+max((t-3.8)^29,0.0)+1.0))':y=622+184-20-60+9:fontsize=46:fontcolor=black:ft_load_flags=render,";

    dateStrXOffset += "+30*" + (subTitle.length + 1);
}
if (metadata.dateStr) {
    filterComplexStr += "drawtext=fontfile=" + dateStrFontPath + ":text='" + metadata.dateStr + "':x='floor(" + dateStrXOffset + ")*(min((t-2.0)^29,0.0)+max((t-3.8)^29,0.0)+1.0))':y=622+184-20-60+9:fontsize=46:fontcolor=black:ft_load_flags=render,";
}
console.log("generateTitleAnimation generating")
filterComplexStr += "split=10[t01][t02][t03][t04][t05][t06][t07][t08][t09][t10];[t02]setpts=PTS+0.0166/TB[d02];[t03]setpts=PTS+0.033/TB[d03];[t04]setpts=PTS+0.05/TB[d04];[t05]setpts=PTS+0.0666/TB[d05];[t06]setpts=PTS+0.083/TB[d06];[t07]setpts=PTS+0.1/TB[d07];[t08]setpts=PTS+0.1166/TB[d08];[t09]setpts=PTS+0.133/TB[d09];[t10]setpts=PTS+0.15/TB[d10];[d10][d09]blend=average,[d08]blend=darken,[d07]blend=average,[d06]blend=darken,[d05]blend=average,[d04]blend=darken,[d03]blend= average,[d02]blend=darken,[t01]blend=average,colorkey=white:0.2:0.0,perspective=y1=W*0.176327:y3=H+W*0.176327[text01];[2][3]overlay=x=(W-w)*0.5:y=(H-h)*0.5:enable='between(t,0,3.0)'[logo01];[logo01][text01]overlay[outv]";

var args = ["-y", "-f", "lavfi", "-i", src01, "-f", "lavfi", "-i", src02, "-i", whiteBarMovPath, "-i", peeqLogoPath, "-filter_complex", filterComplexStr, "-vcodec", "qtrle", "-crf:v", "28", "-codec:a", "aac", "-ac", "2", "-ar", "44100", "-ab", "128k", "-map", "[outv]", destPath];

//console.log("args", args);
return childProcess.spawn('ffmpeg', args).then((ffResult) => {
    return destPath;
}, (err) => {
    //console.error(new Error("generateTitleAnimation:" + err));
    console.error(err);
    return Promise.reject(err);
});};


    


    destPath is a .mov file

    


    Up till a few days ago, the backend started throwing up this error

    


    stderr: 'ffmpeg version 3.4.2-1~16.04.york0.2 Copyright (c) 2000-2018
 the FFmpeg developers\n built with gcc 5.4.0 (Ubuntu 5.4.0-
6ubuntu1~16.04.9) 20160609\n configuration: --prefix=/usr --extra-
version=\'1~16.04.york0.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\n libavutil 55. 78.100 / 55.
 78.100\n libavcodec 57.107.100 / 57.107.100\n libavformat 57. 83.100 /
 57. 83.100\n libavdevice 57. 10.100 / 57. 10.100\n libavfilter 
6.107.100 / 6.107.100\n libavresample 3. 7. 0 / 3. 7. 0\n libswscale 4.
 8.100 / 4. 8.100\n libswresample 2. 9.100 / 2. 9.100\n libpostproc 54.
 7.100 / 54. 7.100\nInput #0, lavfi, from 
\'color=c=white:s=1920x1080:duration=5.52\':\n Duration: N/A, start: 
0.000000, bitrate: N/A\n Stream #0:0: Video: rawvideo (I420 / 
0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25
 tbc\nInput #1, lavfi, from 
\'color=c=white@0.0:s=1920x1080:r=120:duration=5.52\':\n Duration: N/A,
 start: 0.000000, bitrate: N/A\n Stream #1:0: Video: rawvideo (I420 /
 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 120 fps, 120 tbr,
 120 tbn, 120 tbc\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from 
\'/app/assets/whiteBar.mov\':\n Metadata:\n major_brand : qt \n 
minor_version : 537199360\n compatible_brands: qt \n creation_time : 
2018-04-27T15:55:18.000000Z\n Duration: 00:00:05.52, start: 0.000000, 
bitrate: 54847 kb/s\n Stream #2:0(eng): Video: qtrle (rle / 
0x20656C72), bgra(progressive), 1920x1080, 53326 kb/s, SAR 1:1 DAR 16:9, 60 
fps, 60 tbr, 60 tbn, 60 tbc (default)\n Metadata:\n creation_time : 
2018-04-27T15:55:18.000000Z\n handler_name : Apple Alias Data Handler\n
 encoder : Animation\n timecode : 00:00:00:00\n Stream #2:1(eng): Data:
 none (tmcd / 0x64636D74), 0 kb/s (default)\n Metadata:\n creation_time
 : 2018-04-27T15:55:18.000000Z\n handler_name : Apple Alias Data
 Handler\n timecode : 00:00:00:00\nInput #3, png_pipe, from 
\'/app/assets/peeq-logo.png\':\n Duration: N/A, bitrate: N/A\n Stream 
#3:0: Video: png, rgba(pc), 452x207 [SAR 2834:2834 DAR 452:207], 25 
tbr, 25 tbn, 25 tbc\nCodec AVOption crf (Select the quality for 
constant quality mode) specified for output file #0 (/tmp/972967.mov) 
has not been used for any stream. The most likely reason is either 
wrong type (e.g. a video option with no video streams) or that it is a 
private option of some encoder which was not actually used for any 
stream.\nCodec AVOption b (set bitrate (in bits/s)) specified for 
output file #0 (/tmp/972967.mov) has not been used for any stream. The 
most likely reason is either wrong type (e.g. a video option with no 
video streams) or that it is a private option of some encoder which was 
not actually used for any stream.\nStream mapping:\n Stream #1:0 
(rawvideo) -> drawtext\n Stream #2:0 (qtrle) -> overlay:main\n Stream 
#3:0 (png) -> overlay:overlay\n overlay -> Stream #0:0 (qtrle)\nPress 
[q] to stop, [?] for help\n[swscaler @ 0x56080b828180] No accelerated 
colorspace conversion found from yuv420p to argb.\n[swscaler @ 
0x56080b8b5f40] No accelerated colorspace conversion found from yuva420p to argb.\n',


    


    However, this error only occurs on the app engine. Running nom test on my Mac generates the title perfectly.