Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (37)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (11864)

  • ffmpeg sws_scale converting from YUV420P to RGB24 results in wrong color values

    3 novembre 2016, par Drazurh

    I’m using sws_scale to convert a video from YUV420P to RGB24. The resulting RGB values are wrong, looking much more saturated/contrasted. For example, the first pixel should have an RGB value of (223,73,30) but using sws_scale results in (153,0,0).

    Here’s the code I’m using :

    uint8_t *buffer = NULL;
    int numBytes;
    // Determine required buffer size and allocate buffer
    numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
                              pCodecCtx->height);
    buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

    // Assign appropriate parts of buffer to image planes in pFrameRGB
    // Note that pFrameRGB is an AVFrame, but AVFrame is a superset
    // of AVPicture
    std::cout << "Filling picture of size " << pCodecCtx->width <<" x "<height << std::endl;
    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
                   pCodecCtx->width, pCodecCtx->height);



    // initialize SWS context for software scaling
    std::cout << "initializing SWS context\n";
    sws_ctx = sws_getContext(pCodecCtx->width,
       pCodecCtx->height,
       pCodecCtx->pix_fmt,
       pCodecCtx->width,
       pCodecCtx->height,
       PIX_FMT_RGB24,
       SWS_FAST_BILINEAR,
       NULL,
       NULL,
       NULL
    );

    while(frameFinished == 0)
    {
       if(av_read_frame(pFormatCtx, &packet)<0){
           std::cerr << "Could not read frame!\n";
           return false;
       }

       if(packet.stream_index==videoStream)
       {
           avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
       }

    }

    sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,
             pFrame->linesize, 0, pCodecCtx->height,
             pFrameRGB->data, pFrameRGB->linesize);

    The values in pFrameRGB are incorrect. I’ve tried troubleshooting this for hours :-( Any ideas on how to track down my mistake ?

    Here’s a link to the repo. The offending code is in Icosahedron Video Player/mesh.cpp, Mesh::LoadVideo and Mesh::NextFrame().

  • FFMPEG : Video file to YUV conversion by binary ffmpeg and by code C++ give different results

    30 juin 2016, par Anny G

    Disclaimer : I have looked at the following question,
    FFMPEG : RGB to YUV conversion by binary ffmpeg and by code C++ give different results
    but it didn’t help and it is not applicable to me because I am not using SwsContext or anything.

    Following first few tutorials by http://dranger.com/ffmpeg/, I have created a simple program that reads a video, decodes it and then when the frame is decoded, it writes the raw yuv values to a file (no padding), using the data provided by AVFrame after we successfully decoded a frame. To be more specific, I write out arrays AVFrame->data[0], AVFrame->data[1] and AVFrame->data[2] to a file, i.e. I simply append Y values, then U values, then V values to a file. The file turns out to be of yuv422p format.

    When I convert the same original video to a raw yuv format using the ffmpeg(same version of ffmpeg) command line tool, the two yuv files are the same in size, but differ in content.

    FYI, I am able to play both of the yuv files using the yuv player, and they look identical as well.

    Here is the exact command I run to convert the original video to a yuv video using ffmpeg command line tool

    ~/bin/ffmpeg -i super-short-video.h264 -c:v rawvideo -pix_fmt yuv422p  "super-short-video-yuv422p.yuv"

    What causes this difference in bytes and can it be fixed ? Is there perhaps another way of converting the original video to a yuv using the ffmpeg tool but maybe I need to use different settings ?

    Ffmpeg output when I convert to a yuv format :

    ffmpeg version N-80002-g5afecff Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
     configuration: --prefix=/home/me/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/me/ffmpeg_build/include --extra-ldflags=-L/home/me/ffmpeg_build/lib --bindir=/home/me/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --extra-cflags=-pg --extra-ldflags=-pg --disable-stripping
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 42.100 / 57. 42.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, h264, from 'super-short-video.h264':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuv420p, 1280x720, 25 fps, 25 tbr, 1200k tbn
    [rawvideo @ 0x24f6fc0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Output #0, rawvideo, to 'super-short-video-yuv422p.yuv':
     Metadata:
       encoder         : Lavf57.36.100
       Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 1280x720, q=2-31, 200 kb/s, 25 fps, 25 tbn
       Metadata:
         encoder         : Lavc57.42.100 rawvideo
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    frame=   50 fps=0.0 q=-0.0 Lsize=   90000kB time=00:00:02.00 bitrate=368640.0kbits/s speed=11.3x    
    video:90000kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
  • Print results at conclusion of bash 'for loop'

    4 juin 2016, par Matthew Schwarz

    I’m a beginner.
    I have a Bash script that embeds subtitles into mkv files if they exist in a directory.

    for i in *.mkv; do
       if [ -f "${i%mkv}"*"srt" ]; then
           ffmpeg -i "$i" -f srt -i "${i%mkv}"*"srt" -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt $i.output.mkv
           mv "${i%mkv}"*"srt" "${i%mkv}srt".old
           mv $i $i.old
           mv $i.output.mkv $i
       else
           echo $i "does not have srt file"
       fi
    done

    It looks for all .mkv files that have an associated .srt file and does some ffmpeg magic to it. If it does not find an associated .srt file it says that the .mkv file "does not have srt file."

    How can I make it so that at the conclusion of the for loop I get a print out of all the .mkv files that did have an .srt file and did successfully do all the other actions ?

    Thank you.