Recherche avancée

Médias (0)

Mot : - Tags -/configuration

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

Autres articles (55)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (4910)

  • Parsing The Clue Chronicles

    30 décembre 2018, par Multimedia Mike — Game Hacking

    A long time ago, I procured a 1999 game called Clue Chronicles : Fatal Illusion, based on the classic board game Clue, a.k.a. Cluedo. At the time, I was big into collecting old, unloved PC games so that I could research obscure multimedia formats.



    Surveying the 3 CD-ROMs contained in the box packaging revealed only Smacker (SMK) videos for full motion video which was nothing new to me or the multimedia hacking community at the time. Studying the mix of data formats present on the discs, I found a selection of straightforward formats such as WAV for audio and BMP for still images. I generally find myself more fascinated by how computer games are constructed rather than by playing them, and this mix of files has always triggered a strong “I could implement a new engine for this !” feeling in me, perhaps as part of the ScummVM project which already provides the core infrastructure for reimplementing engines for 2D adventure games.

    Tying all of the assets together is a custom high-level programming language. I have touched on this before in a blog post over a decade ago. The scripts are in a series of files bearing the extension .ini (usually reserved for configuration scripts, but we’ll let that slide). A representative sample of such a script can be found here :

    clue-chronicles-scarlet-1.txt

    What Is This Language ?
    At the time I first analyzed this language, I was still primarily a C/C++-minded programmer, with a decent amount of Perl experience as a high level language, and had just started to explore Python. I assessed this language to be “mildly object oriented with C++-type comments (‘//’) and reliant upon a number of implicit library functions”. Other people saw other properties. When I look at it nowadays, it reminds me a bit more of JavaScript than C++. I think it’s sort of a Rorschach test for programming languages.

    Strangely, I sort of had this fear that I would put a lot of effort into figuring out how to parse out the language only for someone to come along and point out that it’s a well-known yet academic language that already has a great deal of supporting code and libraries available as open source. Google for “spanish dolphins far side comic” for an illustration of the feeling this would leave me with.

    It doesn’t matter in the end. Even if such libraries exist, how easy would they be to integrate into something like ScummVM ? Time to focus on a workable approach to understanding and processing the format.

    Problem Scope
    So I set about to see if I can write a program to parse the language seen in these INI files. Some questions :

    1. How large is the corpus of data that I need to be sure to support ?
    2. What parsing approach should I take ?
    3. What is the exact language format ?
    4. Other hidden challenges ?

    To figure out how large the data corpus is, I counted all of the INI files on all of the discs. There are 138 unique INI files between the 3 discs. However, there are 146 unique INI files after installation. This leads to a hidden challenge described a bit later.

    What parsing approach should I take ? I worried a bit too much that I might not be doing this the “right” way. I’m trying to ignore doubts like this, like how “SQL Shame” blocked me on a task for a little while a few years ago as I concerned myself that I might not be using the purest, most elegant approach to the problem. I know I covered language parsing a lot time ago in university computer science education and there is a lot of academic literature to the matter. But sometimes, you just have to charge in and experiment and prototype and see what falls out. In doing so, I expect to have a better understanding of the problems that need to solved and the right questions to ask, not unlike that time that I wrote a continuous integration system from scratch because I didn’t actually know that “continuous integration” was the keyword I needed.

    Next, what is the exact language format ? I realized that parsing the language isn’t the first and foremost problem here– I need to know exactly what the language is. I need to know what the grammar are keywords are. In essence, I need to reverse engineer the language before I write a proper parser for it. I guess that fits in nicely with the historical aim of this blog (reverse engineering).

    Now, about the hidden challenges– I mentioned that there are 8 more INI files after the game installs itself. Okay, so what’s the big deal ? For some reason, all of the INI files are in plaintext on the CD-ROM but get compressed (apparently, according to file size ratios) when installed to the hard drive. This includes those 8 extra INI files. I thought to look inside the CAB installation archive file on the CD-ROM and the files were there… but all in compressed form. I suspect that one of the files forms the “root” of the program and is the launching point for the game.

    Parsing Approach
    I took a stab at parsing an INI file. My approach was to first perform lexical analysis on the file and create a list of 4 types : symbols, numbers, strings, and language elements ([]{}()=., :). Apparently, this is the kind of thing that Lex/Flex are good at. This prototyping tool is written in Python, but when I port this to ScummVM, it might be useful to call upon the services of Lex/Flex, or another lexical analyzer, for there are many. I have a feeling it will be easier to use better tools when I understand the full structure of the language based on the data available.

    The purpose of this tool is to explore all the possibilities of the existing corpus of INI files. To that end, I ran all 138 of the plaintext files through it, collected all of the symbols, and massaged the results, assuming that the symbols that occurred most frequently are probably core language features. These are all the symbols which occur more than 1000 times among all the scripts :

       6248 false
       5734 looping
       4390 scripts
       3877 layer
       3423 sequentialscript
       3408 setactive
       3360 file
       3257 thescreen
       3239 true
       3008 autoplay
       2914 offset
       2599 transparent
       2441 text
       2361 caption
       2276 add
       2205 ge
       2197 smackanimation
       2196 graphicscript
       2196 graphic
       1977 setstate
       1642 state
       1611 skippable
       1576 desc
       1413 delayscript
       1298 script
       1267 seconds
       1019 rect
    

    About That Compression
    I have sorted out at least these few details of the compression :

    bytes 0-3    "COMP" (a pretty strong sign that this is, in fact, compressed data)
    bytes 4-11   unknown
    bytes 12-15  size of uncompressed data
    bytes 16-19  size of compressed data (filesize - 20)
    bytes 20-    compressed payload
    

    The compression ratios are on the same order of gzip. I was hoping that it was stock zlib data. However, I have been unable to prove this. I wrote a Python script that scrubbed through the first 100 bytes of payload data and tried to get Python’s zlib.decompress to initialize– no luck. It’s frustrating to know that I’ll have to reverse engineer a compression algorithm that deals with just 8 total text files if I want to see this effort through to fruition.

    Update, January 15, 2019
    Some folks expressed interest in trying to sort out the details of the compression format. So I have posted a followup in which I post some samples and go into deeper details about things I have tried :

    Reverse Engineering Clue Chronicles Compression

    The post Parsing The Clue Chronicles first appeared on Breaking Eggs And Making Omelettes.

  • EXC_BAD_ACCESS at avformat_find_stream_info in FFMPEG

    27 décembre 2018, par Mubin Mall

    I achieved IP Camera streaming using ffmpeg with the help of this library : https://github.com/kolyvan/kxmovie also I am recording IPCamera streaming coming and same is done using ffmpeg.

    Now I am facing one issue as soon as I add R5ProStreaming.framework in project and run application in real device application is getting crashed at if (avformat_find_stream_info(formatCtx, NULL) < 0) here.
    And when I remove that framework and move it to trash and run again then all working fine.

    - (kxMovieError) openInput: (NSString *) path
    {
       AVFormatContext *formatCtx = NULL;

       if (_interruptCallback) {

           formatCtx = avformat_alloc_context();
           if (!formatCtx)
               return kxMovieErrorOpenFile;

           AVIOInterruptCB cb = {interrupt_callback, (__bridge void *)(self)};
           formatCtx->interrupt_callback = cb;
       }
       AVDictionary *opts = 0;
    //
       av_dict_set(&opts, "rtsp_transport", "tcp", 0);

       if (avformat_open_input(&formatCtx, [path cStringUsingEncoding: NSUTF8StringEncoding], NULL,  &opts) < 0) {
           av_log(NULL, AV_LOG_ERROR, "Couldn't open file\n");
           return kxMovieErrorStreamInfoNotFound;


       }
           if (avformat_open_input(&formatCtx, [path cStringUsingEncoding: NSUTF8StringEncoding], NULL, NULL) < 0) {

           if (formatCtx)
               avformat_free_context(formatCtx);
           return kxMovieErrorOpenFile;
       }

       //-----APP IS GETTING CRASHED HERE AND GIVING EXC_BAD_ACCESS---//
       if (avformat_find_stream_info(formatCtx, NULL) < 0)
       {
           avformat_close_input(&formatCtx);
           return kxMovieErrorStreamInfoNotFound;
       }
    //
       av_dump_format(formatCtx, 0, [path.lastPathComponent cStringUsingEncoding: NSUTF8StringEncoding], false);

       _formatCtx = formatCtx;

       inputFormatCtx = _formatCtx;
       NSString *filePath = [[NSBundle mainBundle] pathForResource:@"newdemo" ofType:@".mov"];

       if (filePath)
       {
           NSLog(@"%s - %d # File found", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           NSLog(@"%s - %d # File NOT found", __PRETTY_FUNCTION__, __LINE__);
       }

       /*
        *  av_find_input_format(const char *short_name)
        *
        *  Find AVInputFormat based on the short name of the input format.
        */
       AVInputFormat *inputFormat = av_find_input_format([@"mpeg" UTF8String]);

       if (inputFormat)
       {
           NSLog(@"%s - %d # inputFormat identifed", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           NSLog(@"%s - %d # inputFormat NOT identifed", __PRETTY_FUNCTION__, __LINE__) ;
       }

       const char *utf8FilePath = [filePath UTF8String];
       NSLog(@"%s - %d # utf8FilePath = %s", __PRETTY_FUNCTION__, __LINE__, utf8FilePath);

       /*
        *  avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
        *
        *  Open an input stream and read the header. The codecs are not opened.
        */
       int openInputValue =0;
       NSLog(@"%s - %d # openInputValue = %d", __PRETTY_FUNCTION__, __LINE__, openInputValue);

       if (openInputValue == 0)
       {
           NSLog(@"%s - %d # Can open the file", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           NSLog(@"%s - %d # Cannot open the file", __PRETTY_FUNCTION__, __LINE__);
           avformat_close_input(&inputFormatCtx);
       }

       /*
        *  Read packets of a media file to get stream information.
        *
        *  avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
        */
       //    int streamInfoValue = avformat_find_stream_info(inputFormatCtx, NULL);
       //    NSLog(@"%s - %d # streamInfoValue = %d", __PRETTY_FUNCTION__, __LINE__, streamInfoValue);
       //
       //    if (streamInfoValue < 0)
       //    {
       //        NSLog(@"%s - %d # streamInfoValue Error", __PRETTY_FUNCTION__, __LINE__);
       //        avformat_close_input(&inputFormatCtx);
       //    }

       /*
        *  nb_streams : Number of Audio and Video streams of the input file
        */

       NSUInteger inputStreamCount = inputFormatCtx->nb_streams;
       NSLog(@"%s - %d # inputStreamCount = %lu", __PRETTY_FUNCTION__, __LINE__, (unsigned long)inputStreamCount);

       for(unsigned int i = 0; istreams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
           {
               NSLog(@"%s - %d # Found Video Stream", __PRETTY_FUNCTION__, __LINE__);
               inputVideoStreamIndex = i;
               inputVideoStream = inputFormatCtx->streams[i];
           }

           if(inputFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
           {
               NSLog(@"%s - %d # Found Audio Stream", __PRETTY_FUNCTION__, __LINE__);
               inputAudioStreamIndex = i;
               inputAudioStream = inputFormatCtx->streams[i];
           }
       }

       if(inputVideoStreamIndex == -1 && inputAudioStreamIndex == -1)
       {
           NSLog(@"%s - %d # Have not found any Video or Audio stream", __PRETTY_FUNCTION__, __LINE__);
       }

       /*
        *  Finding duration of the stream
        */
       if(inputFormatCtx->duration == AV_NOPTS_VALUE)
       {
           NSLog(@"%s - %d # Undefined timestamp value", __PRETTY_FUNCTION__, __LINE__);

           if(_videoStream != -1 && inputFormatCtx->streams[_videoStream])
           {
               //            if(inputFormatCtx->streams[_videoStream]->duration != AV_NOPTS_VALUE)
               //            {
               inputEndtimeInt64 = (inputFormatCtx->streams[_videoStream]->duration)/(inputFormatCtx->streams[_videoStream]->time_base.den/inputFormatCtx->streams[_videoStream]->time_base.num);
               //            }
               //            else
               //            {
               //                inputEndtimeInt64 = (inputFormatCtx->duration)/(AV_TIME_BASE);
               //
               //            }
           }
           else if(_audioStream != -1 && inputFormatCtx->streams[_audioStream])
           {
               //            if(inputFormatCtx->streams[_audioStream]->duration != AV_NOPTS_VALUE)
               //            {
               inputEndtimeInt64 = (inputFormatCtx->streams[_audioStream]->duration)/(AV_TIME_BASE);
               //            }
               //            else
               //            {
               //                inputEndtimeInt64 = (inputFormatCtx->duration)/(AV_TIME_BASE);
               //
               //            }
           }
       }
       else
       {
           NSLog(@"%s - %d # Defined timestamp value", __PRETTY_FUNCTION__, __LINE__);

           inputEndtimeInt64 = (inputFormatCtx->duration)/(AV_TIME_BASE);
       }
       NSLog(@"%s - %d # inputEndtimeInt64 = %lld", __PRETTY_FUNCTION__, __LINE__, inputEndtimeInt64);

       /*
        *  Finding out the frame rate
        */
       if(_videoStream != -1 && inputFormatCtx->streams[_videoStream])
       {

           framesPerSec =  (inputFormatCtx->streams[_videoStream]->r_frame_rate.num)/ (inputFormatCtx->streams[_videoStream]->r_frame_rate.den);
       }
       else
       {
           framesPerSec = 24;
       }

       numberOfFrames = framesPerSec * (int) inputEndtimeInt64;
       NSLog(@"%s - %d # numberOfFrames = %d", __PRETTY_FUNCTION__, __LINE__, numberOfFrames);


       /*
        *  Seek to timestamp ts.
        *
        *  avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
        */

       if(avformat_seek_file(inputFormatCtx, inputAudioStreamIndex, INT64_MIN, outputStartTimeInt64, INT64_MAX, AVSEEK_FLAG_FRAME) < 0)
       {
           NSLog(@"%s - %d # Seek OK", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           NSLog(@"%s - %d # Seek ERROR", __PRETTY_FUNCTION__, __LINE__);
       }

       /*
        *  Creating output file path1
        */

    //    NSString * timestamp = [NSString stringWithFormat:@"%f",[[NSDate date] timeIntervalSince1970] * 1000];
    //    
    //    NSArray *directoryPathsArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    //    NSString *documentsDirectory = [directoryPathsArray objectAtIndex:0];
    //    NSString *outputFilePath = [NSString stringWithFormat:@"%@/%@.mov",documentsDirectory,timestamp]; // Not working if we replace .avi with .mp4

       NSString* filename = [NSString stringWithFormat:@"IPCamera%d.mov", _currentFile];
       NSString* outputFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
       _url = [NSURL fileURLWithPath:outputFilePath];

       /*
        *  Return the output format in the list of registered output formats
        *  which best matches the provided parameters, or return NULL if
        *  there is no match.
        *
        *  av_guess_format(const char *short_name, const char *filename, const char *mime_type)
        */
       outputFormat = av_guess_format(NULL, [outputFilePath UTF8String], NULL);

       NSLog(@"%s - %d # outputFormat->name = %s", __PRETTY_FUNCTION__, __LINE__, outputFormat->name);

       if(outputFormat == NULL)
       {
           NSLog(@"%s - %d # outputFormat == NULL", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           /*
            *  Allocate an AVFormatContext.
            */
           outputContext = avformat_alloc_context();

           if(outputContext)
           {
               outputContext->oformat = outputFormat;      // The output container format.

               snprintf(outputContext->filename, sizeof(outputContext->filename), "%s", [outputFilePath UTF8String]);
           }
           else
           {
               NSLog(@"%s - %d # outputContext == NULL", __PRETTY_FUNCTION__, __LINE__);
           }
       }

       outputVideoCodec = outputAudioCodec = NULL;

       /*
        *  video_codec = default video codec
        */
       if(outputFormat->video_codec != AV_CODEC_ID_NONE && inputVideoStream != NULL)
       {
           /*
            *  Find a registered encoder with a matching codec ID.
            *
            *  avcodec_find_encoder(enum AVCodecID id)
            */
           outputVideoCodec = avcodec_find_encoder(outputFormat->video_codec);

           if(NULL == outputVideoCodec)
           {
               NSLog(@"%s - %d # Could Not Find Vid Encoder", __PRETTY_FUNCTION__, __LINE__);
           }
           else
           {
               NSLog(@"%s - %d # Found Out Vid Encoder", __PRETTY_FUNCTION__, __LINE__);

               /*
                *  Add a new stream to a media file.
                *
                *  avformat_new_stream(AVFormatContext *s, const AVCodec *c)
                */
               outputVideoStream = avformat_new_stream(outputContext, outputVideoCodec);

               if(NULL == outputVideoStream)
               {
                   NSLog(@"%s - %d # Failed to Allocate Output Vid Strm", __PRETTY_FUNCTION__, __LINE__);
               }
               else
               {
                   NSLog(@"%s - %d # Allocated Video Stream", __PRETTY_FUNCTION__, __LINE__);

                   /*
                    *  Copy the settings of the source AVCodecContext into the destination AVCodecContext.
                    *
                    *  avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
                    */

                   if(avcodec_copy_context(outputVideoStream->codec, inputFormatCtx->streams[inputVideoStreamIndex]->codec) != 0)
                   {
                       NSLog(@"%s - %d # Failed to Copy Context", __PRETTY_FUNCTION__, __LINE__);
                   }
                   else
                   {
                       AVStream *st = _formatCtx->streams[_videoStream];
                       outputVideoStream->sample_aspect_ratio.den = outputVideoStream->codec->sample_aspect_ratio.den;     // denominator
                       outputVideoStream->sample_aspect_ratio.num = st->codec->sample_aspect_ratio.num;    // numerator
                       NSLog(@"%s - %d # Copied Context 1", __PRETTY_FUNCTION__, __LINE__);
                       outputVideoStream->codec->codec_id = st->codec->codec_id;
                       outputVideoStream->codec->time_base.num = st->codec->time_base.num;
                       outputVideoStream->codec->time_base.den = STREAM_FRAME_RATE;
                       outputVideoStream->time_base.num = st->time_base.num;
                       outputVideoStream->time_base.den =  st->time_base.den;
                       outputVideoStream->r_frame_rate.num =st->r_frame_rate.num;
                       outputVideoStream->nb_frames = STREAM_NB_FRAMES;
                       outputVideoStream->r_frame_rate.den = st->r_frame_rate.den;
                       outputVideoStream->avg_frame_rate.den = st->avg_frame_rate.num;
                       outputVideoStream->avg_frame_rate.num = st->avg_frame_rate.num;
    //                  outputVideoStream->duration = st->duration;
                   }
               }
           }
       }

       if(outputFormat->audio_codec != AV_CODEC_ID_NONE && inputAudioStream != NULL)
       {
           outputAudioCodec = avcodec_find_encoder(outputFormat->audio_codec);

           if(NULL == outputAudioCodec)
           {
               NSLog(@"%s - %d # Could Not Find Out Aud Encoder", __PRETTY_FUNCTION__, __LINE__);
           }
           else
           {
               NSLog(@"%s - %d # Found Out Aud Encoder", __PRETTY_FUNCTION__, __LINE__);

               outputAudioStream = avformat_new_stream(outputContext, outputAudioCodec);

               if(NULL == outputAudioStream)
               {
                   NSLog(@"%s - %d # Failed to Allocate Out Vid Strm", __PRETTY_FUNCTION__, __LINE__);
               }
               else
               {
                   if(avcodec_copy_context(outputAudioStream->codec, inputFormatCtx->streams[inputAudioStreamIndex]->codec) != 0)
                   {
                       NSLog(@"%s - %d # Failed to Copy Context", __PRETTY_FUNCTION__, __LINE__);
                   }
                   else
                   {
                       //                    AVStream *st = _formatCtx->streams[_audioStream];

                       NSLog(@"%s - %d # Copied Context 2", __PRETTY_FUNCTION__, __LINE__);
                       outputAudioStream->codec->codec_id = inputAudioStream->codec->codec_id;
                       outputAudioStream->codec->codec_tag = 0;
                       //                    outputAudioStream->pts = inputAudioStream->pts;
    //                    outputAudioStream->duration = inputAudioStream->duration;
                       outputAudioStream->time_base.num = inputAudioStream->time_base.num;
                       outputAudioStream->time_base.den = inputAudioStream->time_base.den;
                   }
               }
           }
       }

       if (!(outputFormat->flags & AVFMT_NOFILE))
       {
           /*
            *  Create and initialize a AVIOContext for accessing the resource indicated by url.
            *
            *  avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
            */
           if (avio_open2(&outputContext->pb, [outputFilePath UTF8String], AVIO_FLAG_WRITE, NULL, NULL) < 0)
           {
               NSLog(@"%s - %d # Could Not Open File", __PRETTY_FUNCTION__, __LINE__);
           }
       }

       /* Write the stream header, if any. */
       /*
        *  Allocate the stream private data and write the stream header to an output media file.
        *
        *  avformat_write_header(AVFormatContext *s, AVDictionary **options);
        */
       if (avformat_write_header(outputContext, NULL) < 0)
       {
           NSLog(@"%s - %d # Error Occurred While Writing Header", __PRETTY_FUNCTION__, __LINE__);
       }
       else
       {
           NSLog(@"%s - %d # Written Output header", __PRETTY_FUNCTION__, __LINE__);

           initDone = true;
       }

       return kxMovieErrorNone;
    }

    More over I contacted Red5Pro team and asked them regarding that along with video demo. They replied me like this

    What’s most likely happening is that the version of FFMPEG that’s being loaded by that project is incompatible with the customized version of it that’s embedded in our SDK, and some duplicate definition error is causing the wrong version to be loaded. It could also be any number of conflicts between one of the libraries in that project with the SDK, or one of the support libraries that the sdk requires ( I have to assume that since it compiled, that you did add the libraries listed in step four here : https://www.red5pro.com/docs/streaming/ios.html#project-setup ) and if that’s the case, I don’t know of a good way to correct the issue as chasing down individual third-party libraries that raise incompatibilities with our SDKs to correct them is beyond the reach of our team. (edited)

    Can anybody have idea where to look ?

    Thanks

  • ffmpeg converting JPG slideshow to H264

    22 décembre 2018, par phol

    I am trying to convert a set of jpg files to a slideshow with varying durations using ffconcat

    output.txt contents :

    ffconcat version 1.0
    file slide_0001.jpg
    duration 0.163
    file slide_0002.jpg
    duration 0.533
    file slide_0003.jpg
    duration 1.067
    file slide_0004.jpg
    duration 0.533
    file slide_0005.jpg
    etc.

    FFmpeg command :

    ffmpeg -i output.txt output.mkv

    I also tried :

    ffmpeg -i output.txt -c:v copy output.mkv

    However, when converting, the colours of the images become skewed.
    White becomes pink / purple and dark green becomes light green.
    The same happens when choosing different codecs and containers.
    Is there a way to solve this ?

    EDIT :
    I performed the same conversion again. I attached the log output as requested.
    However, in the meantime I have figured out that converting without ffconcat duration and then altering timecodes with mp4fpsmod is more efficient in terms of storage (3 vs 40 MB) and gives less issues in different players. The result is nonetheless the same : colours are still wrong, both on my workstation (Ubuntu 18.04) and laptop (macOS Mojave).

    I tried to alter things with pix_fmt and -vf format as can be seen in the second log output. This did not solve the problem.

    Background info :
    The input jpg files are from a lecture recording made with MediaSite, which has both a video stream for the room as well as this slideshow stream for the slides.

    Example of input :
    Input image
    Example of output :
    Screenshot of output
    log output MKV conversion :

       $ ffmpeg -i outputnew.txt output12345.mkv
    ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
    built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
    Input #0, concat, from 'outputnew.txt':
    Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720, 25 tbr, 25 tbn, 25 tbc
    Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x7fb284802800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7fb284802800] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
    [libx264 @ 0x7fb284802800] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, matroska, to 'output12345.mkv':
    Metadata:
       encoder         : Lavf58.20.100
       Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj444p(pc), 1280x720, q=-1--1, 25 fps, 1k tbn, 25 tbc
       Metadata:
       encoder         : Lavc58.35.100 libx264
       Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    [mjpeg @ 0x7fb284061200] EOI missing, emulating=00:02:12.96 bitrate= 491.3kbits/s speed=14.3x        
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 487.2kbits/s speed=14.3x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 333.0kbits/s speed=22.3x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 338.8kbits/s speed=22.7x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 164.7kbits/s speed=41.6x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 122.7kbits/s speed=55.7x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 111.2kbits/s speed=60.5x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte= 105.3kbits/s speed=64.4x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  82.2kbits/s speed=82.7x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  79.7kbits/s speed=85.8x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  59.7kbits/s speed= 114x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  53.8kbits/s speed= 127x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  54.7kbits/s speed= 124x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  47.1kbits/s speed= 143x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  47.0kbits/s speed= 144x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  44.6kbits/s speed= 151x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  34.4kbits/s speed= 194x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  32.9kbits/s speed= 204x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  32.8kbits/s speed= 203x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  32.6kbits/s speed= 202x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  28.8kbits/s speed= 229x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  27.9kbits/s speed= 236x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  27.9kbits/s speed= 233x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  23.9kbits/s speed= 274x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  24.2kbits/s speed= 273x    
       Last message repeated 2 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  24.2kbits/s speed= 274x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  24.0kbits/s speed= 276x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  24.2kbits/s speed= 273x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  23.6kbits/s speed= 278x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  23.7kbits/s speed= 279x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  23.6kbits/s speed= 279x    
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  24.0kbits/s speed= 276x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  23.5kbits/s speed= 281x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  20.4kbits/s speed= 325x    
    [mjpeg @ 0x7fb28502a000] EOI missing, emulating
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  20.1kbits/s speed= 329x    
       Last message repeated 1 times
    [matroska @ 0x7fb284812e00] Starting new cluster due to timestampte=  20.1kbits/s speed= 330x    
    frame=  635 fps= 14 q=-1.0 Lsize=   37389kB time=04:22:06.76 bitrate=  19.5kbits/s speed= 343x    
    video:37378kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.029620%
    [libx264 @ 0x7fb284802800] frame I:16    Avg QP:11.98  size:154224
    [libx264 @ 0x7fb284802800] frame P:184   Avg QP:13.30  size: 79029
    [libx264 @ 0x7fb284802800] frame B:435   Avg QP:13.19  size: 48887
    [libx264 @ 0x7fb284802800] consecutive B-frames:  6.0%  4.4% 10.9% 78.7%
    [libx264 @ 0x7fb284802800] mb I  I16..4: 55.7%  0.0% 44.3%
    [libx264 @ 0x7fb284802800] mb P  I16..4: 32.4%  0.0% 21.5%  P16..4: 13.3% 15.1% 11.3%  0.0%  0.0%    skip: 6.4%
    [libx264 @ 0x7fb284802800] mb B  I16..4: 17.8%  0.0%  7.2%  B16..8: 19.1% 19.4%  6.5%  direct:14.6%  skip:15.3%  L0:47.0% L1:38.9% BI:14.1%
    [libx264 @ 0x7fb284802800] coded y,u,v intra: 63.7% 26.1% 56.3% inter: 46.5% 24.6% 43.5%
    [libx264 @ 0x7fb284802800] i16 v,h,dc,p: 19% 18% 58%  4%
    [libx264 @ 0x7fb284802800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 20% 25%  4%  4%  3%  3%  3%  3%
    [libx264 @ 0x7fb284802800] Weighted P-Frames: Y:5.4% UV:5.4%
    [libx264 @ 0x7fb284802800] ref P L0: 43.2%  4.4% 30.8% 21.4%  0.2%
    [libx264 @ 0x7fb284802800] ref B L0: 64.1% 27.3%  8.6%
    [libx264 @ 0x7fb284802800] ref B L1: 85.3% 14.7%
    [libx264 @ 0x7fb284802800] kb/s:19.25

    Log output mp4 conversion :

    $ ffmpeg -i slide_%04d.jpg -vf format=rgba -pix_fmt yuv420p -vcodec libx264 -movflags +faststart -preset veryslow output12345.mp4
    ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
    built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
    Input #0, image2, from 'slide_%04d.jpg':
    Duration: 00:00:25.36, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
    File 'output12345.mp4' already exists. Overwrite ? [y/N] y
    Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [swscaler @ 0x7fb7e280b000] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0x7fb7e1803c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7fb7e1803c00] profile High, level 5.0
    [libx264 @ 0x7fb7e1803c00] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output12345.mp4':
    Metadata:
       encoder         : Lavf58.20.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720, q=-1--1, 25 fps, 12800 tbn, 25 tbc
       Metadata:
       encoder         : Lavc58.35.100 libx264
       Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    [mp4 @ 0x7fb7e1801800] Starting second pass: moving the moov atom to the beginning of the file    
    frame=  634 fps=8.5 q=-1.0 Lsize=    2252kB time=00:00:25.24 bitrate= 731.0kbits/s speed=0.337x    
    video:2245kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.307448%
    [libx264 @ 0x7fb7e1803c00] frame I:5     Avg QP:19.12  size: 49393
    [libx264 @ 0x7fb7e1803c00] frame P:131   Avg QP:22.18  size:  9379
    [libx264 @ 0x7fb7e1803c00] frame B:498   Avg QP:23.78  size:  1652
    [libx264 @ 0x7fb7e1803c00] consecutive B-frames:  3.2%  1.6%  3.3% 29.7%  7.9% 16.1%  7.7% 16.4% 14.2%
    [libx264 @ 0x7fb7e1803c00] mb I  I16..4: 45.7% 37.9% 16.4%
    [libx264 @ 0x7fb7e1803c00] mb P  I16..4:  6.0%  5.3%  1.3%  P16..4: 19.9%  1.9%  3.7%  0.3%  0.1%    skip:61.5%
    [libx264 @ 0x7fb7e1803c00] mb B  I16..4:  0.3%  0.4%  0.1%  B16..8: 17.5%  1.0%  0.2%  direct: 0.3%  skip:80.2%  L0:52.3% L1:46.9% BI: 0.8%
    [libx264 @ 0x7fb7e1803c00] 8x8 transform intra:43.0% inter:48.9%
    [libx264 @ 0x7fb7e1803c00] direct mvs  spatial:99.2% temporal:0.8%
    [libx264 @ 0x7fb7e1803c00] coded y,uvDC,uvAC intra: 16.9% 25.8% 16.6% inter: 1.1% 1.9% 1.2%
    [libx264 @ 0x7fb7e1803c00] i16 v,h,dc,p: 61% 28%  6%  6%
    [libx264 @ 0x7fb7e1803c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20%  9% 50%  3%  4%  3%  3%  3%  5%
    [libx264 @ 0x7fb7e1803c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 23% 19%  5%  7%  6%  6%  5% 10%
    [libx264 @ 0x7fb7e1803c00] i8c dc,h,v,p: 46% 40% 13%  1%
    [libx264 @ 0x7fb7e1803c00] Weighted P-Frames: Y:5.3% UV:5.3%
    [libx264 @ 0x7fb7e1803c00] ref P L0: 33.2%  3.1% 11.6%  7.3%  8.8%  6.4%  6.5%  3.1%  3.2%  2.6%  2.4%  2.5%  2.8%  2.8%  2.3%  1.4%
    [libx264 @ 0x7fb7e1803c00] ref B L0: 42.0% 15.1% 12.0%  5.4%  4.9%  4.3%  4.0%  1.9%  2.0%  1.8%  1.7%  1.8%  1.7%  1.1%  0.5%
    [libx264 @ 0x7fb7e1803c00] ref B L1: 83.5% 16.5%
    [libx264 @ 0x7fb7e1803c00] kb/s:725.10

    Player :
    QuickTime, VLC and Kodi on both Linux and Mac.

    EDIT 2 :
    Input files : https://drive.google.com/open?id=1kbBkSDSwe6ywgQ8lkjqkh-MKCzGA4bj8