Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (51)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

Sur d’autres sites (7260)

  • TTML subtitle missing in HLS

    6 juillet 2020, par playmaker420

    I tried to inject a ttml subtitle into a mp4 file using the following command.

    


    docker run --rm -v `pwd`:/work sambaiz/mp4box -add  my.ttml input.mp4


ffmpeg -i input.mp4 
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
  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
  libavresample   3.  7.  0 /  3.  7.  0
  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     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2017-07-06T10:21:17.000000Z
  Duration: 00:03:46.77, start: 0.000000, bitrate: 1900 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1770 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:2(und): Data: none (stpp / 0x70707473), 3 kb/s (default)
    Metadata:
      creation_time   : 2020-07-06T09:17:16.000000Z
      handler_name    : ***ttml@GPAC0.6.1-rev14-g8eb0297-master**


    


    On playing the input.mp4 with exo player i was able to see the injected ttml subtitle.

    


    Now im trying to conver this mp4 file in to hls using the following command

    


    ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 10 -hls_list_size 0 -f hls index.m3u8

    


    ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 10 -hls_list_size 0 -f hls index.m3u8
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
  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
  libavresample   3.  7.  0 /  3.  7.  0
  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     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2017-07-06T10:21:17.000000Z
  Duration: 00:03:46.77, start: 0.000000, bitrate: 1900 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1770 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:2(und): Data: none (stpp / 0x70707473), 3 kb/s (default)
    Metadata:
      creation_time   : 2020-07-06T09:17:16.000000Z
      handler_name    : *ttml@GPAC0.6.1-rev14-g8eb0297-master
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x2270e20] using SAR=1/1
[libx264 @ 0x2270e20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x2270e20] profile Constrained Baseline, level 3.0
[libx264 @ 0x2270e20] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 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=-2 threads=11 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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
[hls @ 0x226d6a0] Opening 'index0.ts' for writing
Output #0, hls, to 'index.m3u8':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: h264 (libx264), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 90k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      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), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2017-07-06T10:21:17.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      encoder         : Lavc57.107.100 aac
[hls @ 0x226d6a0] Opening 'index1.ts' for writing.16 bitrate=N/A speed=12.1x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index2.ts' for writing.45 bitrate=N/A speed=11.2x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index3.ts' for writing.78 bitrate=N/A speed=10.6x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index4.ts' for writing.72 bitrate=N/A speed=9.91x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index5.ts' for writing.07 bitrate=N/A speed=9.32x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index6.ts' for writing.55 bitrate=N/A speed=9.05x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index7.ts' for writing.72 bitrate=N/A speed=9.27x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index8.ts' for writing.75 bitrate=N/A speed=9.39x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index9.ts' for writing.78 bitrate=N/A speed= 9.1x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index10.ts' for writing25 bitrate=N/A speed=8.95x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index11.ts' for writing47 bitrate=N/A speed=8.77x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index12.ts' for writing99 bitrate=N/A speed=8.61x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index13.ts' for writing83 bitrate=N/A speed=8.32x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index14.ts' for writing89 bitrate=N/A speed=8.43x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index15.ts' for writing25 bitrate=N/A speed= 8.5x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index16.ts' for writing84 bitrate=N/A speed=8.56x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index17.ts' for writing43 bitrate=N/A speed=8.71x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index18.ts' for writing67 bitrate=N/A speed=8.88x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index19.ts' for writing88 bitrate=N/A speed=8.99x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index20.ts' for writing87 bitrate=N/A speed=9.03x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index21.ts' for writing67 bitrate=N/A speed=9.06x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index22.ts' for writing63 bitrate=N/A speed=9.08x    
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writing
[hls @ 0x226d6a0] Opening 'index.m3u8.tmp' for writingitrate=N/A speed=9.12x    
frame= 6796 fps=272 q=-1.0 Lsize=N/A time=00:03:46.76 bitrate=N/A speed=9.08x    
video:25157kB audio:3473kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x2270e20] frame I:44    Avg QP:20.35  size: 33397
[libx264 @ 0x2270e20] frame P:6752  Avg QP:23.97  size:  3598
[libx264 @ 0x2270e20] mb I  I16..4: 28.8%  0.0% 71.2%
[libx264 @ 0x2270e20] mb P  I16..4:  1.6%  0.0%  0.7%  P16..4: 30.3% 13.5%  5.6%  0.0%  0.0%    skip:48.3%
[libx264 @ 0x2270e20] coded y,uvDC,uvAC intra: 33.6% 62.8% 24.4% inter: 14.8% 21.2% 5.5%
[libx264 @ 0x2270e20] i16 v,h,dc,p: 25% 47% 12% 16%
[libx264 @ 0x2270e20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 23% 21%  5%  7%  6%  8%  4%  6%
[libx264 @ 0x2270e20] i8c dc,h,v,p: 54% 30% 13%  4%
[libx264 @ 0x2270e20] ref P L0: 75.4% 14.1% 10.5%
[libx264 @ 0x2270e20] kb/s:908.80
[aac @ 0x221e760] Qavg: 2866.916


    


    Now on playing these segments in exo player i could see the subtitle option listed in exo player but the subtitle is not showing. Can someone help me to figure out the issue

    


    Thanks in advance

    


  • Is there any option to create a single frame thumbnail for a video in java ?

    13 juin 2020, par Prashanth Shyamprasad

    Is there any option to create a single frame thumbnail for a video in java with java libraries.

    



    I am using Jave2 in my application. Does Jave2 provides any such options ? I didn't find a single documentation related to this.

    



    I heard Xuggler provides some options. But I don't want to move to Xuggler if Jave2 provides the facility as I'm already using Jave2 for many purposes extensively. Adding a full library like Xuggler is an overhead. Replacing Jave2 with Xuggler also is a tedious task

    



    If any light weight thumbnail feature specific utility library is available, then that should also be fine.

    


  • 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;
}