Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • FFmpeg avcodec_find_encoder problem

    13 novembre 2012, par net

    I'm newbie in ffmpeg.

    my problem is "avcodec_find_encoder(CODEC_ID_H264);" func always returning null.

    ffmpeg configure is below on my ubuntu system.

    ./ffmpeg
    FFmpeg version SVN-r26306, Copyright (c) 2000-2011 the FFmpeg developers
      built on Jan 11 2011 10:34:49 with gcc 4.4.5
      configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
      libavutil     50.36. 0 / 50.36. 0
      libavcore      0.16. 0 /  0.16. 0
      libavcodec    52.108. 0 / 52.108. 0
      libavformat   52.92. 0 / 52.92. 0
      libavdevice   52. 2. 3 / 52. 2. 3
      libavfilter    1.72. 0 /  1.72. 0
      libswscale     0.12. 0 /  0.12. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    

    as you can see, configuration contains --enable-libx264

    so I think avcodec_find_encoder(CODEC_ID_H264); have to return something not null... please let me know how to solve this problem?

    ps) I call avcodec_init() and av_register_all() in my program.

    when I compile my test program, using below

    gcc -o test test.c -lavutil -lavformat -lavcodec -lx264 -lz -lm
    

    thanks

  • ffmpeg get RGB values ?

    13 novembre 2012, par Nav

    I've seen this, this and this but I still can't figure out how to get the RGB values from the tutorial code.

    if(avcodec_open(pCodecCtx, pCodec)<0) {_getch();return -1;}
    pFrame = avcodec_alloc_frame();
    pFrameRGB=avcodec_alloc_frame();
    if(pFrameRGB==NULL)    {_getch();return -1;}
    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
    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
    
    i=0;
    int framecounter=0;
    while(av_read_frame(pFormatCtx, &packet)>=0) 
    {
      if(packet.stream_index==videoStream) 
        {
          // Decode video frame
          //int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const AVPacket *avpkt);
          avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
    
          if(frameFinished) 
          {
             // Convert the image from its native format to RGB
         //img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
             if(++i<=5)  {SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, i);}
          }
        }
      av_free_packet(&packet);
    }
    

    Since img_convert wasn't available, I took it from here but it threw an unhandled exception error. Why is the RGB format so tough to understand? Why assign zero to G and B of RGB, as shown here?

    How can I get my RGB values as a simple R, G and B which spans between 0 and 255? Also, I don't understand the use of x and y, when video width and height are already given. y is an increment of height, but what about x?

    Can anyone please show me a complete working code of obtaining rgb values from a video or at least explain how data and linesize help in storing RGB info? The lack of tutorials is appalling and the complexity of the API is surprising, after having worked on Processing videos.

  • FFMPEG - how to hard encode with srt subtitle

    13 novembre 2012, par user1777711

    FFMPEG - how to hard encode with srt subtitle

    I actually tried the following

    ffmpeg -i "video.avi" -i "video.srt" -vcodec x264 -acodec aac "video.mp4" -newsubtitle but it doesn't work. sort of like the subtitle doesn't appear.
    
  • Tube site like thumbnails for videos- hover over and show rotating thumbnails from the movie

    13 novembre 2012, par slycat

    A lot of adult sites (and mainstream tube sites) have thumbnails of videos, and when you hover over them they cycle through a few differnt thumbnails so you know what is in the video.

    Does anyone know what the name for this is called, and if there is a good library for doing this (either something that captures the images (eg with ffmpeg) or some JS library for this?

  • Soft subtitles on iPhone

    12 novembre 2012, par forthrin

    I know this question (or similar ones) has been asked all over the Web, but I still can't find a straight answer:

    1. Is it possible to mux soft subtitles into an mp4 video file (quickly, without re-encoding the video stream) that iPhone will actually display on the screen? I have tried ffmpeg, MP4Box, Subler, Submerge and mp4v2 and none of them were successful in producing mp4 file that would display subtitles on iPhone (though some of them had subtitles when playing the video in VLC or iTunes).

    2. If iPhone does not support soft subtitles in mp4 files, then is there any command line utility (like the ones mentioned in question 1) that will render hard subtitles onto the video stream? (I guess then this process will take hours since the video will have to be re-encoded)

    3. Finally, if there is no command line utility that can do hard subtitles, what options are there for GUI-based utilities? Is Handbrake the best option?

    If possible, please supply a command line example.