Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg or mencoder to add audio to avi with audio

    24 novembre 2011, par bastardz

    Can I add audio to file which already has audio. I have avi with couple of sound fx and now I want to add loop in the background. I've tried mencoder test.avi -o out.avi -ovc copy -oac mp3lame -audiofile loop.mp3 but it adds loop instead existing audio in test.avi

  • how can I enable CRCs in EZstream or FFMPEG ?

    24 novembre 2011, par Nadal

    I want to detect a corrupt MP3 stream, the encoder is using CRC.

    How can I enable CRC?. I want to be able to read through the headers of each frame to find the CRC, and then run it on the audio data. In the event I get an error (or several frames with errors), I can then somehow trigger a warning.

    I am new to this so I can't tell what to do or how to accomplish this.

  • WMA decoding with ffmpeg failed

    24 novembre 2011, par Ali

    I have problem in decoding WMA/WMAPRO stream with ffmpeg.i have filled extra data from the coming stream.I am able to get bit rate, sample rate, extradata size and other parameters so there is no problem with the codecCtx initilization.

    avcodec_open(codecCtx, codec);
    

    returns -1

    Anyone help me!

  • Choppy sound when using ffmpeg

    24 novembre 2011, par Kurt

    I suffered some choppy audio when i try to capture audio from a live stream. Another essential problem which could explain the problem is that the Wav file created is twice longer than the capture time.

    The audio is perfect when i play the avs input file with ffplay, so the avs is ok, the problem is after whether in the capture or in the Wav writing.

    To capture :

    av_read_frame(pFormatCtx, &packet)
    
    if(packet.stream_index == mAudioStream)
    {
        int buff_size = sizeof(mAudioBuffer);
        std::cout << "Buff_size " << buff_size << std::endl;
        len = avcodec_decode_audio3(pAudioCodecCtx,(int16_t*)mAudioBuffer, &buff_size,&packet);
        if(len < 0){
            qDebug("Extractor - Audio isEnd = -1;");
            mAudioBufferSize = 0;
            isEnd = ERROR_;
            return isEnd;
        }
    
        // Set packet result type
        mFrameType = AUDIO_PKT;
        mAudioBufferSize = buff_size;
        //store audio synchronization informations:
        if(packet.pts != AV_NOPTS_VALUE) {
             mAudioPts_ = av_q2d(pFormatCtx->streams[mAudioStream]->time_base);
             mAudioPts_ *= packet.pts;
        }
    }
    
            // store a copy of current audio frame in _frame
            _frame.audioFrame = new decoded_frame_t::audio_frame_t();
            _frame.audioFrame->sampleRate = mediaInfos.audioSampleRate;
            _frame.audioFrame->sampleSize = mediaInfos.audioSampleSize;
            _frame.audioFrame->nbChannels = mediaInfos.audioNbChannels;
            _frame.audioFrame->nbSamples = mAudioBufferSize / ((mediaInfos.audioSampleSize/8) * mediaInfos.audioNbChannels);
            _frame.audioFrame->buf.resize(mAudioBufferSize);
            memcpy(&_frame.audioFrame->buf[0],mAudioBuffer,mAudioBufferSize);
    

    Then i store in a Wav File using libsndfile :

    SNDFILE*            fd;
    SF_INFO             sfInf;
    
    sfInf.frames = 0;
    sfInf.channels = p_capt->ui_nbChannels;
    sfInf.samplerate = p_capt->ui_sampleRate;
    sfInf.format = SF_FORMAT_WAV | SF_FORMAT_PCM_U8;
    sfInf.sections = 0;
    sfInf.seekable = 0;
    
    if (sf_format_check(&sfInf) == FALSE)
        std::cout << "Format parameter are uncorrect ! Exit saving !" << std::endl;
    else
    {
        fd = sf_open(fileName.toStdString().c_str(), SFM_WRITE, &sfInf);
        if (fd == NULL)
        {
            std::cout << "Unable to open the file " << fileName.toStdString() << std::endl;
            return GRAB_ST_NOK;
        }
    
        //little trick because v_buf is a uint8_t vector
        sf_count_t l = sf_write_short(fd, (const short *)(&(p_capt->v_buf[0])), p_capt->v_buf.size()/2);
    
        if (l != p_capt->v_buf.size()/2)
        {
           std::cout << "sf_write didn't write the right amoung of bits " << l << " != " << p_capt->v_buf.size()/2 << std::endl;
           ret = GRAB_ST_NOK;
        }
        else
        {
            sf_write_sync(fd);
            sf_close(fd);
            ret = GRAB_ST_OK;
        }
    }
    

    I hope it's understandable. Waiting for remarks.

    Kurt

  • Link dynamic library and ffmpeg x86_64 version

    24 novembre 2011, par daniel

    I'm working with FFMPEG on Mac OSX, my Mac version is 10.6.8 (i386).

    When I try to compile my C++ code linking a dynamic library:

    g++ sdk.cpp -rpath /usr/local/lib/libinsight.dylib -o sdk
    

    I get the following error:

    Undefined symbols for architecture x86_64:
      "_main", referenced from:
        start in crt1.10.6.o
      "av_open_input_file(AVFormatContext**, char const*, AVInputFormat*, int,  AVFormatParameters*)", referenced from:
        ffmpeg_open(AVFormatContext**, char const*, int*)in ccCkx9dd.o
    
      (so forth fo every FFMPEG call)
    
      ld: symbol(s) not found for architecture x86_64
      collect2: ld returned 1 exit status
    

    Without linking dylib I have no problem. What's the matter?

    P.S. ffmpeg version is Mach-O 64-bit executable x86_64