Recherche avancée

Médias (0)

Mot : - Tags -/api

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

Autres articles (111)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

Sur d’autres sites (10285)

  • How to get non-decoded h264 stream from the webcam using ffmpeg ?

    14 mars 2018, par irobo

    I want to get the file which is non-decoded h264 format to use in another client application. I know how to stream to disk using below command from the docs.

    Example to encode video from /dev/video0 :

    ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mp4

    High level Diagram

    This is typical producer and consumer problem -

    Webcam  =============> ffmpeg to  video stream into file. (producer)                                    
                                          ^
                                          |
                                          |
    Client ________________________________|
    (consumer)
    // reads only Non-decoded h264 format from a file.
  • How to send an mpeg_ts stream verbatim over rtp

    30 mars 2018, par Bruce Adams

    I’m trying to write some software to capture and process data from an mpeg_ts stream.
    As part of this I need, for testing, to generate a test mpeg_ts streams for my software to capture

    One option for this is to save a real stream to disk.
    So with that in mind I have a source transport stream which is being unicast via rtp to my box via port 1234. I can view it in vlc using :

    vlc rtp://@:1234

    and I can move between channels via the "programme" menu.
    subtitles are available but no EPG
    kaffeine works as well but only shows the first channel

    I can save this stream using :

    ffmpeg -i rtp://172.16.13.81:1235 -map 0 -copy_unknown -c copy save_ffmpeg.ts

    note : that rtp ://@:1235 does not work you need your full IP address though udp ://@:1235 does work for udp streams - see https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2386

    However there is a problem. When I try to open the resulting file save_ffmpeg.ts in VLC
    instead of opening one channel at a time it opens a new window for each channel which indicates an issue.

    If on the other hand I save it using :

    cvlc rtp://@:1235 :demux=dump :demuxdump-file=save_vlc.ts

    the resulting ts file can be viewed as normal.
    What is the difference ?

    Looking at the output of mediainfo on save_ffmpeg.ts vs save_vlc.ts
    I can see that ffmpeg has stripped the streams labelled Menu #1 to Menu #5.

    >mediainfo save_ffmpeg.ts  | grep -E '^[A-Za-z]+ #'
    Video #1
    Video #2
    Video #3
    Video #4
    Video #5
    Audio #1
    Audio #2
    Audio #3
    Audio #4
    Audio #5
    Audio #6
    Audio #7
    >mediainfo save_vlc.ts  | grep -E '^[A-Za-z]+ #'
    Video #1
    Video #2
    Video #3
    Video #4
    Video #5
    Audio #1
    Audio #2
    Audio #3
    Audio #4
    Audio #5
    Audio #6
    Audio #7
    Menu #1
    Menu #2
    Menu #3
    Menu #4
    Menu #5

    I tried adding -map_metadata 0 but to no avail.

    Q1 What is wrong with the ffmpeg command ?
    How do I get it to also save the menu streams ?

    Now I can send the ts that has the menu with ffmpeg using :

    ffmpeg -re -i save_vlc.ts -c copy -f mpegts udp://127.0.0.1:9999

    to get one channel
    but again if I try to send everything :

    ffmpeg -re -i ./save_file.ts -map 0 -map_metadata 0 -copy_unknown -c copy -f rtp_mpegts rtp://127.0.0.1:9999

    then :

    vlc rtp://127.0.0.1:9999

    opens a window for each and every channel.

    Q2 How do I fix this ?

    Q3 What would the equivalent gstreamer commands be to send and recieve ts files ?

    The relevance of the final question is that one of the options being considered for implementing the MPEG_TS reader is gstreamer. Though, it probably warrants a question of its own.

  • Display ffmpeg frames on opgel texture

    21 mars 2018, par naki

    I am using Dranger tutorial01 (ffmpeg) to decode the video and get AVI frames. I want to use OpenGL to display the video.

    http://dranger.com/ffmpeg/tutorial01.html

    The main function is as follows :

    int main (int argc, char** argv) {
    // opengl stuff
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA);
    glutInitWindowSize(800, 600);
    glutCreateWindow("Hello GL");

    glutReshapeFunc(changeViewport);
    glutDisplayFunc(render);

    GLenum err = glewInit();
    if(GLEW_OK !=err){
       fprintf(stderr, "GLEW error");
       return 1;
    }

    glClear(GL_COLOR_BUFFER_BIT);


    glEnable(GL_TEXTURE_2D);
    GLuint texture;
    glGenTextures(1, &texture); //Make room for our texture
    glBindTexture(GL_TEXTURE_2D, texture);

    //ffmpeg stuff

    AVFormatContext *pFormatCtx = NULL;
    int             i, videoStream;
    AVCodecContext  *pCodecCtx = NULL;
    AVCodec         *pCodec = NULL;
    AVFrame         *pFrame = NULL;
    AVFrame         *pFrameRGB = NULL;
    AVPacket        packet;
    int             frameFinished;
    int             numBytes;
    uint8_t         *buffer = NULL;

    AVDictionary    *optionsDict = NULL;


    if(argc < 2) {
    printf("Please provide a movie file\n");
    return -1;
    }
    // Register all formats and codecs

    av_register_all();

    // Open video file
    if(avformat_open_input(&pFormatCtx, argv[1], NULL, NULL)!=0)
      return -1; // Couldn't open file

    // Retrieve stream information

    if(avformat_find_stream_info(pFormatCtx, NULL)<0)
    return -1; // Couldn't find stream information

    // Dump information about file onto standard error
    av_dump_format(pFormatCtx, 0, argv[1], 0);

    // Find the first video stream

    videoStream=-1;
    for(i=0; inb_streams; i++)
    if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
     videoStream=i;
     break;
    }
    if(videoStream==-1)
    return -1; // Didn't find a video stream

    // Get a pointer to the codec context for the video stream
    pCodecCtx=pFormatCtx->streams[videoStream]->codec;

    // Find the decoder for the video stream
    pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
    if(pCodec==NULL) {
      fprintf(stderr, "Unsupported codec!\n");
      return -1; // Codec not found
    }
    // Open codec
    if(avcodec_open2(pCodecCtx, pCodec, &optionsDict)<0)
      return -1; // Could not open codec

    // Allocate video frame
    pFrame=av_frame_alloc();

    // Allocate an AVFrame structure
    pFrameRGB=av_frame_alloc();
    if(pFrameRGB==NULL)
    return -1;

    // 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));

    struct SwsContext      *sws_ctx = sws_getContext(pCodecCtx->width,
              pCodecCtx->height, pCodecCtx->pix_fmt, 800,
              600, PIX_FMT_RGB24, SWS_BICUBIC, NULL,
              NULL, NULL);


    // Assign appropriate parts of buffer to image planes in pFrameRGB
    // Note that pFrameRGB is an AVFrame, but AVFrame is a superset
    // of AVPicture
    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
        pCodecCtx->width, pCodecCtx->height);

    // Read frames and save first five frames to disk
    i=0;
    while(av_read_frame(pFormatCtx, &packet)>=0) {


    // Is this a packet from the video stream?
    if(packet.stream_index==videoStream) {
     // Decode video frame
     avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished,
              &packet);

     // Did we get a video frame?
     if(frameFinished) {
    // Convert the image from its native format to RGB
     /*  sws_scale
       (
           sws_ctx,
           (uint8_t const * const *)pFrame->data,
           pFrame->linesize,
           0,
           pCodecCtx->height,
           pFrameRGB->data,
           pFrameRGB->linesize
       );
      */
    sws_scale(sws_ctx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
     // additional opengl
       glBindTexture(GL_TEXTURE_2D, texture);

           //gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pCodecCtx->width, pCodecCtx->height, GL_RGB, GL_UNSIGNED_INT, pFrameRGB->data[0]);
      // glTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, 840, 460, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);

           glTexImage2D(GL_TEXTURE_2D,                //Always GL_TEXTURE_2D
               0,                            //0 for now
               GL_RGB,                       //Format OpenGL uses for image
               pCodecCtx->width, pCodecCtx->height,  //Width and height
               0,                            //The border of the image
               GL_RGB, //GL_RGB, because pixels are stored in RGB format
               GL_UNSIGNED_BYTE, //GL_UNSIGNED_BYTE, because pixels are stored
                               //as unsigned numbers
               pFrameRGB->data[0]);               //The actual pixel data
     // additional opengl end  

    // Save the frame to disk
    if(++i<=5)
     SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height,
           i);
     }
    }

    glColor3f(1,1,1);
    glBindTexture(GL_TEXTURE_2D, texture);
    glBegin(GL_QUADS);
       glTexCoord2f(0,1);
       glVertex3f(0,0,0);

       glTexCoord2f(1,1);
       glVertex3f(pCodecCtx->width,0,0);

       glTexCoord2f(1,0);
       glVertex3f(pCodecCtx->width, pCodecCtx->height,0);

       glTexCoord2f(0,0);
       glVertex3f(0,pCodecCtx->height,0);

    glEnd();
    // Free the packet that was allocated by av_read_frame
    av_free_packet(&packet);
    }


     // Free the RGB image
    av_free(buffer);
    av_free(pFrameRGB);

    // Free the YUV frame
    av_free(pFrame);

    // Close the codec
    avcodec_close(pCodecCtx);

    // Close the video file
    avformat_close_input(&pFormatCtx);

    return 0;
    }

    Unfortunately i could not find my solution here

    ffmpeg video to opengl texture

    The program compiles but does not show any video on the texture. Just a OpenGL window is created.