Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Ffmpeg I/O error

    11 septembre 2011, par David542

    I am trying to get info on a file. I can this on either a file or url on my local machine. However, when using my server, I can only get info on a file. This is what happens when I try a URL:

    [david542@web ~]$ ffmpeg -i http://url/1video.mp4
    FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: --enable-gpl --enable-libamr-nb --enable-libamr-wb --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-nonfree
      libavutil     49.14. 0 / 49.14. 0
      libavcodec    52.15. 0 / 52.15. 0
      libavformat   52.28. 0 / 52.28. 0
      libavdevice   52. 1. 0 / 52. 1. 0
      built on Apr 30 2009 20:58:02, gcc: 4.1.2 20080704 (Red Hat 4.1.2-44)
    http://url/1video.mp4: I/O error occurred
    Usually that means that input file is truncated and/or corrupted.
    

    However, the file is not corrupted, as this works fine on my local machine. What do I need to do to fix this? Thank you.

  • Http Streaming from ffmpeg, How to get a sequenced packet ?

    10 septembre 2011, par manutd

    I am trying to make http streaming program.
    So I follow this code at this.
    However, when i decode, only one frame is decoded.
    I think I need call back function.
    Do you know how to make a call back function?
    I know 'asf' packet's call back function is like int read_data(void *opaque, char *buf, int buf_size)

    But the other formats(mp3, ogg, aac, ..) doesn't work..

    Please help me.

    Any advice or comment are very appreciated.

    #include 
    #include 
    #include avcodec.h>
    #include avformat.h>
    #include avdevice.h>
    
    int main(int argc, char **argv)
    {
            static AVInputFormat *file_iformat;
            static AVFormatContext *pFormatCtx;
            AVFormatParameters params;
    
            AVCodecContext *pCodecCtx;
            AVCodec *pCodec;
    
            const char url[] = "http://listen.radionomy.com/feelingfloyd";
    
            avcodec_register_all();
            avdevice_register_all();
            av_register_all();
    
            av_log_set_level(AV_LOG_VERBOSE);
    
            file_iformat = av_find_input_format("mp3"); /* mp3 demuxer */
            if (!file_iformat)
            {
                    fprintf(stderr, "Unknown input format: %s\n", &url[0]);
                    exit(1);
            }
    
            //file_iformat->flags |= AVFMT_NOFILE; /* ??? */
            params.prealloced_context = 0;
    
            if (av_open_input_file(&pFormatCtx, &url[0], file_iformat, 0, &params) != 0)
            {
                    fprintf(stderr, "err 1\n");
                    exit(2);
            }
    
            /* poulates AVFormatContex structure */
            if (av_find_stream_info(pFormatCtx) < 0)
            {
                    fprintf(stderr, "err 2\n");
            }
    
            /* sanity check (1 stream) */
            if (pFormatCtx->nb_streams != 1 &&
                            pFormatCtx->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
            {
                    fprintf(stderr, "err 3\n");
            }
    
            pCodecCtx = pFormatCtx->streams[0]->codec;
    
            /* find decoder for input audio stream */
            pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
            if (pCodec == NULL)
            {
                    fprintf(stderr, "err 4: unsupported codec\n");
            }
    
            if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
                    pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
    
            if (avcodec_open(pCodecCtx, pCodec) < 0)
            {
                    fprintf(stderr, "err 5\n");
            }
    
            {
                    uint8_t *pAudioBuffer;
                    AVPacket pkt;
    
                    int ret;
                    int data_size = 2 * AVCODEC_MAX_AUDIO_FRAME_SIZE;
    
                    av_init_packet(&pkt);
                    //pkt.data=NULL;
                    //pkt.size=0;
                    //pkt.stream_index = 0;
    
                    pAudioBuffer = av_malloc(data_size * sizeof(int16_t));
    
                    while (av_read_frame(pFormatCtx, &pkt) == 0) {
                            //data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
                            ret = avcodec_decode_audio3(pFormatCtx->streams[pkt.stream_index]->codec,
                                            (int16_t *)pAudioBuffer, &data_size, &pkt);
    
                            /* got an error (-32) here */
                            if (ret < 0) {
                                    av_strerror(ret, (char *)pAudioBuffer, data_size);
                                    fprintf(stderr, "err 6 (%s)\n", pAudioBuffer);
                                    break;
                            }
    
                            printf("size=%d, stream_index=%d |ret=%d data_size=%d\n",
                                            pkt.size, pkt.stream_index, ret, data_size);
                            av_free_packet(&pkt);
                    }
    
                    av_free(pAudioBuffer);
            }
    
            avcodec_close(pCodecCtx);
            av_close_input_file(pFormatCtx);
    
            return 0;
    }
    
  • Decoding RIMM streaming file format

    10 septembre 2011, par Thomas

    I want to decode the video (visual) frames within a Blackberry RIMM file. So far I have a parser, and some corresponding container documentation from RIM.

    The video codec is H264 and is explicitly set on the device using one of the video.encodings properties. However, FFMPEG is not able to decode the frames and this is driving me nuts.

    Edit 1: The issues seems to be lack of SPS and PPS in the frames, and artificially inserting them have proven unsuccessful so far (all grey image). Blackberry 9700 sends

    0x00 0x00 0x?? 0x?? 0xType

    where Type is according to table 7-1 in the H264 spec (I and P frames). We believe the 0x?? 0x?? represent the size of the frame, however the size does not always correspond to the size found by the parser (the parser seems to be working correctly).

    I have a windows decoder codec from blackberry, called mc_demux_mp2_ds.ax, and can play some MPEG-4 files captured the same way, but it is a binary for windows. And the H264 files will not play either way. I am aware of previous attempts. The capture url for javax.microedition.media.Manager is

    encoding=video-3gpp_width=176_height=144_video_codec=H264_audio_codec=AAC
    

    and I am writing to an output stream. Some example files here.

    Edit 2:Turns out that about 3-4 of the 12-15 available video capture modes are flat out failing and refusing to output data, even in the simplest of test applications. So any working solution should implement MPEG-4, H264 and H263 in both AMR and AAC, in so getting fallback alternatives when one sound codec and/or resolution fails. Reboots, hangs and what not litters the Blackberry video implementation and vary from firmware to firmware; total suckage.

  • Virtual host compared to multiple servers

    9 septembre 2011, par josiecat

    This may be dumb but has me wondering why and I know how to setup the virtual host but need to know the why or what it is good for.

    Why do you setup virtual host for local development and why not just put sub directories?

    What are the real world uses and how do you use virtual host?

    (my normal set up as of now) I use Mamp and just put more folders (speaking dummy terms here) in the htdocs folder. Is that ok what am I missing?

    The reason why I would like to use virtual hosting is because I would like to have a few servers to try different technologies (e.g. adding ffmpeg support for streaming video and many others ) but do I use virtual hosting to be able to have more than one server or do I need to use something like virtual machine to have multiple servers with different versions of PHP, Mysql etc...?

    I understand how to set this stuff up just don't understand the difference from virtual host to multiple servers? could I actually set up one with php just the basic and another for php with ffmpeg-php and other stuff like zend or what ever just to have different server environments to basically mock the actual server that the project will land when done?

  • Which value exactly tells the video stream bit rate in ffmpeg output ?

    8 septembre 2011, par userffmpeg

    I have a basic doubt. In the following ffmpeg output, which of the bit rate values (in bold) tells us the video bit rate?

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_0135.MOV': Metadata: major_brand : qt minor_version : 537331968 compatible_brands: qt CAEP creation_time : 2011-04-25 14:59:29 Duration: 00:00:33.03, start: 0.000000, bitrate: 20588 kb/s Stream #0.0(eng): Video: h264 (Constrained Baseline), yuvj420p, 1280x720, 19028 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc Metadata: creation_time : 2011-04-25 14:59:29 Stream #0.1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s Metadata: creation_time : 2011-04-25 14:59:29

    Its a very basic question, but I would appreciate if anyone could tell me...