Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (32)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

Sur d’autres sites (6276)

  • Q. FFMPEG - linux (Rasberry pi 4- Raspbian)- FFMPEG av_read_frame error

    5 juin 2020, par KNS

    User environment

    



    -Raspberry Pi 4B 4G x2

    



    -arm32 & arm64

    



    -OS : Raspbian

    



    -gcc (Raspbian 8.3.0-6+rpi1) 8.3.0

    



    -ffmpeg version 4.1.4-1+rpt7 deb10u1
 built with gcc 8 (Raspbian 8.3.0-6+rpi1)

    



    -IDE-visual studio 2017-ssh connetction

    



    Good morning. I have a question and post it.

    



    When Raspbian is installed, the installed FFMPEG library is used.

    



    I want to output a video display - file encoded in h264 using gtk3.0.

    



    When I open the video file & find the codec and try to read the frame,
I get an error and I'm asking.Error symptoms

    



      

    1. AVPacket struct memory padding ? error
    2. 


    



    2.AVPacket-data error:Cannot access memory at address 0xxxxxxxxxxxx>

    



      

    1. AVPacket-stream_index value error- The stream_index and flags values ​​seem to have been reversed.
    2. 


    



    my source code and error photos are attached.
Thank you.

    



    case 1 stream_index error (flags value ->stream_index)

    



    enter image description here

    



    case 2 data memory access error

    



    enter image description here

    



    typedef struct _struMovContext2
{
AVFormatContext*    pFormatCtx;
AVCodecContext*     pVCodecCtx;
AVCodecContext*     pACodecCtx;
AVCodec*            pVCodec;
AVCodec*            pACodec;
int                 nVStreamIndex;
int                 nAStreamIndex;
struct SwsContext*  pSwsCtx;
GtkWidget*          pImage;
pthread_t           tID;    
}MovContext2;

static MovContext2      Ctx;

static void pixmap_destroy_nf(guchar *pixels, gpointer data)
{
    printf("Destroy pixmap - not sure how\n");
}

static void* PlayBackGround(void* pData)
{
MovContext2*    pCtx = NULL;
GdkPixbuf*      pixbuf = NULL;
GError*         error = NULL;   
int             nFrameWidth, nFrameHeight;
int             nFrameEos = 0;
AVFrame*        pFrame = NULL;
AVFrame*        pPicture_RGB = NULL;
AVPacket        packet;
uint8_t*        pBuffer = NULL;

cairo_surface_t*    surface = NULL;
cairo_t*            cr = NULL;

//if ((pCtx = static_cast(pData)) == NULL)
pCtx = &Ctx;
if(pCtx == NULL)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't get context struct - Data nullpointer");
    return NULL;
}

printf("In Thread - PlayBackGround\n");


if ((pFrame = av_frame_alloc()) == NULL)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't alloc frame");
    return NULL;
}

if ((pPicture_RGB = av_frame_alloc()) == NULL)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't alloc Picture RGB");
    return NULL;
}

if ((pBuffer = (uint8_t*)malloc(avpicture_get_size(AV_PIX_FMT_RGB24, 1920, 1080))) == NULL)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't malloc data buffer");
    return NULL;
}
avpicture_fill((AVPicture*)pPicture_RGB, pBuffer, AV_PIX_FMT_RGB24, 1920, 1080);*/

av_init_packet(&packet);    
packet.data = NULL;
packet.size = 0;

//packet = *av_packet_alloc();

while (av_read_frame(pCtx->pFormatCtx, &packet) >= 0)
{
    printf("Read packet stream index : %d\n", packet.stream_index);

    if (packet.stream_index == pCtx->nVStreamIndex)
    {
        //av_usleep(33670);

        printf("Decoding to frame start\n");
        if (avcodec_decode_video2(pCtx->pVCodecCtx, pFrame, &nFrameEos, &packet) < 0)
        {
            av_log(NULL, AV_LOG_ERROR, "Decod video error");
            return NULL;
        }
        printf("Decoding to frame end\n");

        nFrameWidth = pCtx->pVCodecCtx->width;
        nFrameHeight = pCtx->pVCodecCtx->height;

        printf("frame Width : %d, Height : %d\n", nFrameWidth, nFrameHeight);

        pCtx->pSwsCtx = sws_getContext(nFrameWidth,
            nFrameHeight,
            pCtx->pVCodecCtx->pix_fmt,
            nFrameWidth,
            nFrameHeight,
            AV_PIX_FMT_RGB24,
            SWS_BICUBIC,
            NULL, NULL, NULL);

        printf("sws Get context\n");

        if (nFrameEos > 0)
        {
            sws_scale(  pCtx->pSwsCtx,
                        pFrame->data,
                        pFrame->linesize,
                        0,
                        nFrameHeight,
                        pPicture_RGB->data,
                        pPicture_RGB->linesize);

            printf("sws set scale\n");

            pixbuf = gdk_pixbuf_new_from_data(pPicture_RGB->data[0],
                GDK_COLORSPACE_RGB,
                0,
                8,
                nFrameWidth,
                nFrameHeight,
                pPicture_RGB->linesize[0],
                pixmap_destroy_nf,
                NULL);

            printf("create pixbuf from frame data\n");

            gtk_image_set_from_pixbuf((GtkImage*)pCtx->pImage, pixbuf);

            g_object_unref(pixbuf);
            cairo_surface_destroy(surface);
            cairo_destroy(cr);

            //gdk_threads_leave();

        }
        av_free_packet(&packet);
    }
}


printf("Exit Thread\n");

return NULL;
}


int main(int argc, char *argv[])
{
GtkWidget*          overlay;
GtkWidget*          eventBox;
GError*             err = NULL;
CMonitorManager*    pManager;
GdkRectangle        Rect;
char*               pFileURI = "/home/pi/test.mp4";
//char*             pFileURI = "/home/ubuntu/test.mp4";
//char*             pFileURI = "/home/ubuntu/cev.avi";
int                 nIndex;
//MovContext2           Ctx;

//XInitThreads();   
memset(&Ctx, 0x00, sizeof(Ctx));
av_register_all();

if (avformat_open_input(&Ctx.pFormatCtx, pFileURI, NULL, NULL) != 0)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't open file");
    return FALSE;
}
printf("C - open uri\n");

if (avformat_find_stream_info(Ctx.pFormatCtx, NULL) != 0)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't find stream information");
    return FALSE;
}
printf("C - find stream info\n");

av_dump_format(Ctx.pFormatCtx, 0, pFileURI, 0);
printf("C - media dump\n");

Ctx.nVStreamIndex = av_find_best_stream(Ctx.pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
if (Ctx.nVStreamIndex == AVERROR_STREAM_NOT_FOUND)
{
    for (nIndex = 0; nIndex < Ctx.pFormatCtx->nb_streams; nIndex++)
    {
        if (Ctx.pFormatCtx->streams[nIndex]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
        {
            Ctx.nVStreamIndex = nIndex;
            break;
        }
    }

    if (Ctx.nVStreamIndex < 0)
    {
        av_log(NULL, AV_LOG_ERROR, "Didn't find a video stream");
        return FALSE;
    }
}
printf("C - get video stream index\n");

Ctx.nAStreamIndex = av_find_best_stream(Ctx.pFormatCtx, AVMEDIA_TYPE_AUDIO, Ctx.nVStreamIndex, -1, NULL, 0);
if (Ctx.nAStreamIndex == AVERROR_STREAM_NOT_FOUND)
{
    for (nIndex = 0; nIndex < Ctx.pFormatCtx->nb_streams; nIndex++)
    {
        if (Ctx.pFormatCtx->streams[nIndex]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
        {
            Ctx.nAStreamIndex = nIndex;
            break;
        }
    }

    if (Ctx.nAStreamIndex < 0)
    {
        av_log(NULL, AV_LOG_ERROR, "Didn't find a audio stream");
    }
}
printf("C - get audio stream index\n");

if ((Ctx.pFormatCtx->streams[Ctx.nVStreamIndex]->codecpar = avcodec_parameters_alloc()) == NULL)
{
    av_log(NULL, AV_LOG_ERROR, "Couldn't alloc video codec parameters");
    return FALSE;
}
avcodec_parameters_from_context(Ctx.pFormatCtx->streams[Ctx.nVStreamIndex]->codecpar,
    Ctx.pFormatCtx->streams[Ctx.nVStreamIndex]->codec);
printf("C - video codec parameter alloc\n");


Ctx.pVCodec = avcodec_find_decoder(Ctx.pFormatCtx->streams[Ctx.nVStreamIndex]->codecpar->codec_id);
printf("C - find video codec %s \n", Ctx.pVCodec->long_name);
Ctx.pVCodecCtx = avcodec_alloc_context3(Ctx.pVCodec);

avcodec_parameters_to_context(Ctx.pVCodecCtx, Ctx.pFormatCtx->streams[Ctx.nVStreamIndex]->codecpar);

if (avcodec_open2(Ctx.pVCodecCtx, Ctx.pVCodec, NULL) < 0)
{
    av_log(NULL, AV_LOG_ERROR, "Could not open video codec");
    return FALSE;
}
printf("C - video codec context oepn\n");

if (Ctx.nAStreamIndex > 0)
{
    if ((Ctx.pFormatCtx->streams[Ctx.nAStreamIndex]->codecpar = avcodec_parameters_alloc()) != NULL)
    {
        avcodec_parameters_from_context(Ctx.pFormatCtx->streams[Ctx.nAStreamIndex]->codecpar,
            Ctx.pFormatCtx->streams[Ctx.nAStreamIndex]->codec);
        printf("C - audio codec parameter alloc\n");

        Ctx.pACodec = avcodec_find_decoder(Ctx.pFormatCtx->streams[Ctx.nAStreamIndex]->codecpar->codec_id);
        printf("C - find audio codec\n");
        Ctx.pACodecCtx = avcodec_alloc_context3(Ctx.pACodec);

        if (avcodec_open2(Ctx.pACodecCtx, Ctx.pACodec, NULL) < 0) {
            av_log(NULL, AV_LOG_ERROR, "Could not open audio codec");
        }
        printf("C - audio codec context oepn\n");
    }
    else
    {
        av_log(NULL, AV_LOG_ERROR, "Couldn't alloc video codec parameters");
    }
}

Ctx.pVCodecCtx->width = 1920;
Ctx.pVCodecCtx->height = 1080;

Ctx.pSwsCtx = sws_getContext(Ctx.pVCodecCtx->width,
    Ctx.pVCodecCtx->height,
    Ctx.pVCodecCtx->pix_fmt,
    Ctx.pVCodecCtx->width,
    Ctx.pVCodecCtx->height,
    AV_PIX_FMT_YUV420P,
    SWS_BILINEAR,
    NULL,
    NULL,
    NULL);

pthread_create(&Ctx.tID, NULL, PlayBackGround, &Ctx);

GtkWidget *window;

gtk_init(&argc, &argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

Ctx.pImage = gtk_image_new();
gtk_container_add(GTK_CONTAINER(window), Ctx.pImage);

gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 1920, 1080);
gtk_widget_show_all(window);

gtk_main();

return 0;
}


    


  • Unplayable video after running FFmpeg command

    25 mai 2020, par HB.

    I asked this question last year. I resolved the issue I had and I implemented the same logic for merging an image with a video, instead of two images. This is running on Android.

    



    Here is the command I'm using currently :

    



    "-i", mFilePath, "-i", drawingPath, "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*47/80/2))':'max(ih\\,2*trunc(ow*80/47/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outputFPS, outputPath}


    



    47/80/2 is calculated by getting a device's screen dimensions - 1128 x 1920.

    



    When running this on certain devices, it results in an unplayable video.

    



    But running the following command works perfectly fine :

    



    "-i", mFilePath, "-crf", "18", "-c:v", "libx264", "-preset", "ultrafast", outputPath};


    



    I think the issue is with the filter being applied ?

    




    



    I compared running the first command on two different devices.

    



      

    • On the first device (Samsung J7 Pro), I was able to run the command successfully and play the video afterward. I tested the output on both devices and it is working.
    • 


    • On the second device (Sony Xperia Tablet Z), I was able to run the command successfully but could not play the video. I tested the output on both devices and it doesn't play on either. It does play on my computer.
    • 


    



    I compared the original video with the one not working and the one without a filter and the only difference I could find is that the one that is not working profile is Baseline@L4.2 and the one without a filter profile is Baseline@L4.0. The original video profile is High@L4.0.

    



    Here are all the videos. The original, the one without a filter (working) and the one with the filter(no working).

    



    I have no idea why this is happening ? Any help would be appreciated.

    




    



    Edit 1 :

    



    Here is the actual log as requested :

    



    "-i", "/storage/emulated/0/Android/data/com.my.package/files/CameraTemp/2020_05_24_09_17_53.mp4", "-i", "/storage/emulated/0/Android/data/com.my.package/files/MyVideos/tempShapes.png", "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*47/80/2))':'max(ih\\,2*trunc(ow*80/47/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", "30", "/storage/emulated/0/Android/data/com.my.package/files/MyVideos/video with line.mp4"


    



    and here is the complete log :

    



    ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.9.x (GCC) 20150123 (prerelease)
  configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Android/data/com.my.package/files/CameraTemp/2020_05_24_09_17_53.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-05-24T08:18:02.000000Z
  Duration: 00:00:01.64, start: 0.000000, bitrate: 20750 kb/s
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080, 18056 kb/s, SAR 1:1 DAR 16:9, 29.70 fps, 29.67 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : SoundHandle
Input #1, png_pipe, from '/storage/emulated/0/Android/data/com.my.package/files/MyVideos/tempShapes.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1920x1128, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (h264) -> scale (graph 0)
  Stream #1:0 (png) -> scale2ref:default (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
[libx264 @ 0xb83fc8a0] using SAR=1/1
[libx264 @ 0xb83fc8a0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0xb83fc8a0] profile Constrained Baseline, level 4.2
[libx264 @ 0xb83fc8a0] 264 - core 152 r2851M ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=2 keyint_min=1 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to '/storage/emulated/0/Android/data/com.my.package/files/MyVideos/video with line.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1128 [SAR 1:1 DAR 80:47], q=-1--1, 29 fps, 14848 tbn, 29 tbc (default)
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-05-24T08:18:02.000000Z
      handler_name    : SoundHandle
      encoder         : Lavc58.18.100 aac
frame=    1 fps=0.4 q=0.0 size=       0kB time=00:00:01.01 bitrate=   0.4kbits/s speed=0.397x    
frame=    5 fps=1.6 q=0.0 size=       0kB time=00:00:01.01 bitrate=   0.4kbits/s speed=0.33x    
frame=    9 fps=2.5 q=24.0 size=     256kB time=00:00:01.01 bitrate=2075.0kbits/s speed=0.28x    
frame=   13 fps=3.1 q=25.0 size=    1024kB time=00:00:01.01 bitrate=8298.9kbits/s speed=0.243x    
frame=   18 fps=3.8 q=29.0 size=    2048kB time=00:00:01.01 bitrate=16597.5kbits/s speed=0.214x    
frame=   21 fps=3.9 q=25.0 size=    2560kB time=00:00:01.01 bitrate=20746.7kbits/s speed=0.19x    
frame=   23 fps=3.9 q=25.0 size=    2816kB time=00:00:01.01 bitrate=22821.4kbits/s speed=0.173x    
frame=   26 fps=4.0 q=29.0 size=    3584kB time=00:00:01.01 bitrate=29045.3kbits/s speed=0.156x    
Past duration 0.617577 too large
Past duration 0.639641 too large
frame=   28 fps=3.9 q=29.0 size=    3840kB time=00:00:01.01 bitrate=31119.9kbits/s speed=0.142x    
Past duration 0.665230 too large
frame=   29 fps=3.8 q=25.0 size=    3840kB time=00:00:01.01 bitrate=31119.9kbits/s speed=0.132x    
Past duration 0.690834 too large
Past duration 0.711281 too large
Past duration 0.736885 too large
frame=   32 fps=3.9 q=29.0 size=    4608kB time=00:00:01.01 bitrate=37343.8kbits/s speed=0.123x    
Past duration 0.762474 too large
Past duration 0.783577 too large
Past duration 0.807564 too large
frame=   35 fps=3.9 q=25.0 size=    4864kB time=00:00:01.01 bitrate=39418.4kbits/s speed=0.112x    
Past duration 0.831551 too large
Past duration 0.855537 too large
frame=   37 fps=3.5 q=25.0 size=    5376kB time=00:00:01.01 bitrate=43567.7kbits/s speed=0.0968x    
Past duration 0.879524 too large
Past duration 0.903511 too large
frame=   39 fps=3.4 q=25.0 size=    5376kB time=00:00:01.06 bitrate=41196.6kbits/s speed=0.0927x    
Past duration 0.927498 too large
Past duration 0.951500 too large
frame=   41 fps=3.4 q=25.0 size=    5376kB time=00:00:01.13 bitrate=38700.0kbits/s speed=0.0931x    
frame=   41 fps=3.2 q=25.0 size=    5376kB time=00:00:01.13 bitrate=38700.0kbits/s speed=0.0886x    
frame=   41 fps=3.1 q=25.0 size=    5888kB time=00:00:01.43 bitrate=33554.2kbits/s speed=0.108x    
Past duration 0.975487 too large
frame=   45 fps=3.2 q=26.0 size=    6656kB time=00:00:01.60 bitrate=33905.4kbits/s speed=0.114x    
frame=   45 fps=3.0 q=-1.0 Lsize=    8158kB time=00:00:01.65 bitrate=40480.7kbits/s speed=0.11x    
video:8127kB audio:28kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.032895%
[libx264 @ 0xb83fc8a0] frame I:23    Avg QP:24.70  size:337646
[libx264 @ 0xb83fc8a0] frame P:22    Avg QP:29.00  size: 25250
[libx264 @ 0xb83fc8a0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0xb83fc8a0] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4: 43.6%  0.0%  0.0%  0.0%  0.0%    skip:56.0%
[libx264 @ 0xb83fc8a0] coded y,uvDC,uvAC intra: 90.0% 84.7% 58.1% inter: 20.1% 6.2% 0.1%
[libx264 @ 0xb83fc8a0] i16 v,h,dc,p: 25% 28% 28% 20%
[libx264 @ 0xb83fc8a0] i8c dc,h,v,p: 39% 25% 20% 16%
[libx264 @ 0xb83fc8a0] kb/s:42901.20
[aac @ 0xb83d7d10] Qavg: 3517.779


    


  • FFMPEG - latest build doesn't work, earlier build does

    21 juin 2020, par rossmcm

    I have been using FFMPEG to overlay coloured rectangles on a video. I updated FFMPEG and it no longer works. No error is issued, it just doesn't do the job - the resulting video is the same as the input video. Here's the script :

    


    FFMpeg -y -i Input.mp4 -filter_complex \
  "nullsrc=size=1920x1080,  \
  drawbox=x=200:y=100:w=300:h=150:t=20:c=yellow,  fade=in:st=10:d=1:alpha=1, fade=out:st=20:d=2:alpha=1 [tmp1]; \ 
  nullsrc=size=1920x1080,  \
  drawbox=x=240:y=140:w=300:h=150:t=20:c=red,  fade=in:st=15:d=1:alpha=1, fade=out:st=25:d=2:alpha=1 [tmp2]; \
  [tmp1][tmp2] overlay=0:0:shortest=1[tmp3]; \
  [0:v][tmp3] overlay=0:0:shortest=1" \
  Output.mp4


    


    The output video should be the input video with a yellow rectangle added from T=10 to T=20 and a red rectangle from T=15 to T=25, fading them in and out.

    


    The version that was working (3.4) was one that came with an ImageMagick installation. The version I updated it to was 4.2.3. I tried it on various other builds I had lying around and it only works with 3.4.

    


    It seems unlikely that this is a regression so I haven't submitted a bug report. I figure it's more likely that I'm not doing something correctly and 3.4 is more lenient on its interpretation of my command.

    


    Whatever, I prefer to be working with a current build, so I invite comments on what the reasons might be.

    


    Console dump of 3.4 run

    


    ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:48.67, start: 0.000000, bitrate: 1693 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1562 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000001f0d4a0e6a0] using SAR=1/1
[libx264 @ 000001f0d4a0e6a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001f0d4a0e6a0] profile High, level 4.0
[libx264 @ 000001f0d4a0e6a0] 264 - core 152 r2851 ba24899 - 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=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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, mp4, to 'Output-34.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.107.100 aac
frame= 3260 fps= 25 q=-1.0 Lsize=   21461kB time=00:01:48.56 bitrate=1619.3kbits/s speed=0.828x
video:19713kB audio:1634kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.534457%
[libx264 @ 000001f0d4a0e6a0] frame I:14    Avg QP:17.68  size:208205
[libx264 @ 000001f0d4a0e6a0] frame P:844   Avg QP:21.55  size: 16867
[libx264 @ 000001f0d4a0e6a0] frame B:2402  Avg QP:28.40  size:  1263
[libx264 @ 000001f0d4a0e6a0] consecutive B-frames:  0.7%  2.9%  0.4% 96.0%
[libx264 @ 000001f0d4a0e6a0] mb I  I16..4: 14.0% 39.6% 46.4%
[libx264 @ 000001f0d4a0e6a0] mb P  I16..4:  0.4%  0.7%  0.2%  P16..4: 20.2%  9.1%  4.6%  0.0%  0.0%    skip:64.8%
[libx264 @ 000001f0d4a0e6a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 12.4%  0.4%  0.1%  direct: 0.1%  skip:87.1%  L0:42.9% L1:55.2% BI: 1.9%
[libx264 @ 000001f0d4a0e6a0] 8x8 transform intra:45.2% inter:68.3%
[libx264 @ 000001f0d4a0e6a0] coded y,uvDC,uvAC intra: 64.4% 81.6% 45.1% inter: 2.9% 4.2% 0.1%
[libx264 @ 000001f0d4a0e6a0] i16 v,h,dc,p: 32% 26%  6% 37%
[libx264 @ 000001f0d4a0e6a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 20% 15%  5%  6%  7%  7%  7%  8%
[libx264 @ 000001f0d4a0e6a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 28%  8%  4%  6%  6%  6%  5%  5%
[libx264 @ 000001f0d4a0e6a0] i8c dc,h,v,p: 37% 25% 28% 10%
[libx264 @ 000001f0d4a0e6a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001f0d4a0e6a0] ref P L0: 70.4% 15.3% 10.8%  3.5%
[libx264 @ 000001f0d4a0e6a0] ref B L0: 93.1%  6.0%  0.9%
[libx264 @ 000001f0d4a0e6a0] ref B L1: 97.8%  2.2%
[libx264 @ 000001f0d4a0e6a0] kb/s:1486.03
[aac @ 000001f0d4a10a20] Qavg: 1586.609


    


    And 4.2.3

    


    ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200523
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:48.67, start: 0.000000, bitrate: 1693 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1562 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000001e7b4531d40] using SAR=1/1
[libx264 @ 000001e7b4531d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001e7b4531d40] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 000001e7b4531d40] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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, mp4, to 'Output-423.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.54.100 aac
frame= 3260 fps= 28 q=-1.0 Lsize=   21425kB time=00:01:48.56 bitrate=1616.7kbits/s speed=0.917x
video:19686kB audio:1625kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.535352%
[libx264 @ 000001e7b4531d40] frame I:14    Avg QP:17.68  size:208355
[libx264 @ 000001e7b4531d40] frame P:844   Avg QP:21.54  size: 16838
[libx264 @ 000001e7b4531d40] frame B:2402  Avg QP:28.43  size:  1261
[libx264 @ 000001e7b4531d40] consecutive B-frames:  0.7%  2.9%  0.4% 96.0%
[libx264 @ 000001e7b4531d40] mb I  I16..4: 13.9% 39.7% 46.4%
[libx264 @ 000001e7b4531d40] mb P  I16..4:  0.4%  0.7%  0.2%  P16..4: 20.2%  9.1%  4.6%  0.0%  0.0%    skip:64.8%
[libx264 @ 000001e7b4531d40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 12.4%  0.4%  0.1%  direct: 0.1%  skip:87.1%  L0:42.9% L1:55.2% BI: 1.9%
[libx264 @ 000001e7b4531d40] 8x8 transform intra:45.3% inter:68.3%
[libx264 @ 000001e7b4531d40] coded y,uvDC,uvAC intra: 65.2% 82.4% 45.8% inter: 2.9% 4.2% 0.1%
[libx264 @ 000001e7b4531d40] i16 v,h,dc,p: 32% 24%  6% 38%
[libx264 @ 000001e7b4531d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 14%  5%  6%  7%  7%  7%  8%
[libx264 @ 000001e7b4531d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 28%  8%  4%  6%  6%  6%  5%  5%
[libx264 @ 000001e7b4531d40] i8c dc,h,v,p: 37% 24% 28% 11%
[libx264 @ 000001e7b4531d40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001e7b4531d40] ref P L0: 70.4% 15.3% 10.8%  3.5%
[libx264 @ 000001e7b4531d40] ref B L0: 93.1%  6.0%  0.9%
[libx264 @ 000001e7b4531d40] ref B L1: 97.8%  2.2%
[libx264 @ 000001e7b4531d40] kb/s:1483.98
[aac @ 000001e7b47fa800] Qavg: 1462.566