Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Decode Audio from Memory - C++

    12 décembre 2013, par user2492388

    I have two functions:

    • a internet-socket function which gets mp3-data and writes it to file ,
    • a function which decodes mp3-files.

    However, I would rather decode the data, which is currently written to disk, be decoded in-memory by the decode function.

    My decode function looks like this, and it is all initialized via

        avformat_open_input(AVCodecContext, filename, NULL, NULL) 
    

    How can I read in the AVCodecContext without a filename, and instead using only the in-memory buffer?

  • error in ffmpeg when sending image from pipe via php

    12 décembre 2013, par Abdul Ali

    used the following tutorial to send an uploaded image to ffmpeg from php via pipe.

    Image pipe from php to ffmpeg

    however it raises an eror saying that the pipe has invalid data in it.

    pipe:: Invalid data found when processing input
    

    following is the php code for uploading an image file

    $tempPath = $_FILES['vdofile']['tmp_name'];
    
    print_r($tempPath);
    
    $descriptorspec = array(
        0 => array("pipe", "r"), // stdin is a pipe that the child will read from
        1 => array("pipe", "w"), // stdout is a pipe that the child will write to
        2 => array("file", "error-output.txt", "a") // stderr is a file to write to
        );
    
    $img = imagecreatefromjpeg($tempPath);
    
     $proc = proc_open("ffmpeg image2pipe -i - -y image.jpg", $descriptorspec, $pipes);
    
     if (is_resource($proc)) {     
         /*
          * $pipes[0] = write something to command being run
          * $pipes[1] = read something from command
          * $pipes[2] = error from command 
          */
           fwrite($pipes[0], $_FILES['vdofile']['tmp_name']);
           fclose($pipes[0]);
     }
     proc_close($proc);
    ?>
    

    and simple html uploading code is as follows:

     

    the error file generated is as follows:

        ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
      built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 55.100 / 52. 55.100
      libavcodec     55. 44.100 / 55. 44.100
      libavformat    55. 21.102 / 55. 21.102
      libavdevice    55.  5.101 / 55.  5.101
      libavfilter     3. 91.100 /  3. 91.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    pipe:: Invalid data found when processing input
    

    any assistance will be appreciated.

    **

    EDIT

    **

    the code still produces an error:

        ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
      built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 55.100 / 52. 55.100
      libavcodec     55. 44.100 / 55. 44.100
      libavformat    55. 21.102 / 55. 21.102
      libavdevice    55.  5.101 / 55.  5.101
      libavfilter     3. 91.100 /  3. 91.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    [image2pipe @ 00000000029ee0a0] Could not find codec parameters for stream 0 (Video: none): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    pipe:: could not find codec parameters
    

    the following ffmpeg comand is called from within php like above:

    ffmpeg -f image2pipe -i - -vcodec mjpeg -vframes 1 -an -f mjpeg image.mp4
    
  • Failed to login to icecast2 with oggfwd

    12 décembre 2013, par Peter

    I have a problem, when i try to mix two source to one for icecast2. Oggfwd cannot login to the icecast server. I check the password, it is correct. Here is everything:

    ffmpeg -i http://localhost:8080/mix1.ogg -i http://localhost:8080/mix2.ogg -filter_complex "pan=stereo:c0dev/stdout - | oggfwd -p localhost 8080 *********** /hmradio.ogg
    

    And the output:

    ffmpeg version N-59015-g3efe5e3 Copyright (c) 2000-2013 the FFmpeg developers
      built on Dec 12 2013 05:15:11 with gcc 4.6 (Debian 4.6.3-1)
      configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32 --extra-cflags='-m32 -I/root/ffmpeg-static/32bit/include -static' --extra-ldflags='-m32 -L/root/ffmpeg-static/32bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
      libavutil      52. 58.100 / 52. 58.100
      libavcodec     55. 45.101 / 55. 45.101
      libavformat    55. 22.100 / 55. 22.100
      libavdevice    55.  5.102 / 55.  5.102
      libavfilter     3. 92.100 /  3. 92.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    oggfwd: Error connecting: Login failed
    Input #0, ogg, from 'http://localhost:8080/mix1.ogg':
      Duration: 159957:31:20.33, start: 942.319456, bitrate: N/A
        Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
        Metadata:
          ENCODER         : mixxx/libvorbis
    Input #1, ogg, from 'http://localhost:8080/mix2.ogg':
      Duration: 159957:32:38.32, start: 864.329433, bitrate: N/A
        Stream #1:0: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
        Metadata:
          ENCODER         : mixxx/libvorbis
    [Parsed_pan_0 @ 0x9f40ba0] This syntax is deprecated. Use '|' to separate the list items.
    [flac @ 0x9fa6720] encoding as 24 bits-per-sample
    Output #0, ogg, to 'pipe:':
      Metadata:
        encoder         : Lavf55.22.100
        Stream #0:0: Audio: flac, 44100 Hz, stereo, s32, 128 kb/s
        Metadata:
          encoder         : Lavf55.22.100
    Stream mapping:
      Stream #0:0 (vorbis) -> pan
      pan -> Stream #0:0 (flac)
    Press [q] to stop, [?] for help
    [ogg @ 0x8fd5480] Estimating duration from bitrate, this may be inaccurate
    Input #0, ogg, from 'pipe:':
      Duration: N/A, start: 0.000000, bitrate: N/A
        Stream #0.0: Audio: flac, 44100 Hz, 2 channels, s32
        Metadata:
          ENCODER         : Lavf55.22.100
    WARNING: Can't get duration of media, not indexing, writing Skeleton 3 track.
    

    Thanks.

  • ffmpeg commad with colorchannelmixer

    12 décembre 2013, par bindal

    I am using following command: command = "ffmpeg -y -i "+strFinalPath+" -vf colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3 "+strRotatePath;

    But this command exit with error code 1

    is there any mistake in this command

    Please suggest me

    Thanks

  • How to use the ffmpeg library to transpose a video ?

    12 décembre 2013, par beni

    I'm trying to develop an video recorder and playback app in Android. So, I'm using the ffmpeg library and I've compiled the library to use in the project.

    I record a video and when I playback, in some devices don't recognize the orientation matrix, so I want to develop with the ffmpeg library a C method to do this order:

    ffmpeg -i f.mp4 -vf "transpose=1" -r 24 -sameq f2.mp4"

    I found this documentation but don't help me, because don't use the AVFilter and AVFilterContext classes.

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

    http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/structAVFilterContext.html

    http://ffmpeg.org/doxygen/trunk/api-example_8c-source.html

    Now I only have the opening and closing video file

    Here my code:

    /*open the video file*/
    if ((lError = av_open_input_file(&gFormatCtx, gFileName, NULL, 0, NULL)) !=0 ) {
        LOGE(1, "Error open video file: %d", lError);
        return; //open file failed
    }
    /*retrieve stream information*/
    if ((lError = av_find_stream_info(gFormatCtx)) < 0) {
        LOGE(1, "Error find stream information: %d", lError);
        return;
    } 
    /*find the video stream and its decoder*/
    gVideoStreamIndex = av_find_best_stream(gFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &lVideoCodec, 0);
    if (gVideoStreamIndex == AVERROR_STREAM_NOT_FOUND) {
        LOGE(1, "Error: cannot find a video stream");
        return;
    } else {
    LOGI(10, "video codec: %s", lVideoCodec->name);
    }
    if (gVideoStreamIndex == AVERROR_DECODER_NOT_FOUND) {
        LOGE(1, "Error: video stream found, but no decoder is found!");
        return;
    }   
    /*open the codec*/
    gVideoCodecCtx = gFormatCtx->streams[gVideoStreamIndex]->codec;
    LOGI(10, "open codec: (%d, %d)", gVideoCodecCtx->height, gVideoCodecCtx->width);
    #ifdef SELECTIVE_DECODING
    gVideoCodecCtx->allow_selective_decoding = 1;
    #endif
    if (avcodec_open(gVideoCodecCtx, lVideoCodec) < 0) {
    LOGE(1, "Error: cannot open the video codec!");
        return;
    }
    LOGI(10, "get video info ends");
    

    How can I transpose the video using the ffmpeg library?