Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Wired Out of memory : Java heap space error with ffmpeg library

    23 mai 2019, par steve moretz

    Well this is the error I get:

    Out of memory: Java heap space.
    Please assign more memory to Gradle in the project's gradle.properties file.
    For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
    org.gradle.jvmargs=-Xmx1024m
    

    and it is because of:

    implementation 'nl.bravobit:android-ffmpeg:1.1.7'
    

    when I remove that the error gets gone.Well the error is saying increase the heap size to 1024MB and I did increase it to 10GB it's not still working.That's what is wired.

    org.gradle.jvmargs=-Xmx10000m
    

    still getting the same error.also tried this:

    
    

    still no chance.Please do not suggest to use an alternative library because I can't.

  • lame mp3 change bitrate cpp

    23 mai 2019, par user2018761

    I need to change mp3 bitrate, I'm using lame for cpp project under Windows and Linux. I think I need to convert mp3 to wav and then wav to mp3 with desired bitrate.

    For wav to mp3 I already have the code (using lame) it works.
    For mp3 to wav there is problem with app crashing on hip_decode.
    Probably due to ID3 tags at the beginning of the file.
    How to skip the ID3 tags or is this a different problem?

    This is code I'm using

    bool Helper::convert2Wav(QString fromFile, QString toFile) {
        int read, write;
        int ctn = 0;
    
        FILE *mp3_in =fopen(fromFile.toLocal8Bit().data(),"rb");
        //this should be WAV
        FILE *pcm_out =fopen(toFile.toLocal8Bit().data(),"wb");
    
        const int PCM_SIZE = 4096;
        const int MP3_SIZE = 4096;
    
        short int pcm_buffer[PCM_SIZE*2];
        short int pcm_buffer1[PCM_SIZE];
        short int pcm_buffer2[PCM_SIZE];
        unsigned char mp3_buffer[MP3_SIZE];
    
    
        memset(pcm_buffer, 0, sizeof(pcm_buffer));
        memset(pcm_buffer1, 0, sizeof(pcm_buffer1));
        memset(pcm_buffer2, 0, sizeof(pcm_buffer2));
        memset(mp3_buffer, 0, sizeof(mp3_buffer));
    
        lame_t lame = lame_init();
        hip_t l = hip_decode_init();
        lame_set_in_samplerate(lame, 44100);
        //lame_set_VBR(lame, vbr_default);
        //lame_set_mode(lame, MONO);
        lame_init_params(lame);
    
        qDebug()<<"start decoding";
    
        do {
            ctn += 4096;
            qDebug()<<"a message:"</read = hip_decode(l, mp3_buffer, MP3_SIZE, pcm_buffer1,pcm_buffer2);
    
            //memcpy(pcm_buffer, pcm_buffer1, sizeof(pcm_buffer1));
            //memcpy(&pcm_buffer[PCM_SIZE], pcm_buffer2, sizeof(pcm_buffer2));
            //write = lame_encode_buffer_interleaved(lame, pcm_buffer, read,mp3_buffer, MP3_SIZE);
            //fwrite(pcm_buffer, 1, sizeof(pcm_buffer), pcm_out);
    
        } while (read != 0);
    
        hip_decode_exit(l);
        lame_close(lame);
        fclose(pcm_out);
        fclose(mp3_in);
    
        return true;
    }
    

    It is crashing with an output:

    start decoding
    a message: 4096
    a message: 8192
    a message: 12288
    1   ??                                 0x7ffff7b8f0b5     
    2   hip_decode1_headers                0x7ffff7b8f34b     
    3   hip_decode1_headers                0x7ffff7b8f385     
    4   hip_decode_headers                 0x7ffff7b8f42d     
    5   hip_decode                         0x7ffff7b8f47c     
    6   Helper::convert2Wav helper.cpp 498 0x5555555b0fe7     
    7   ??                                 0x4490551063006a0  
    
            MP3_SIZE    258346945   int
            PCM_SIZE    234884892   int
            ctn 189860957   int
            l   1050198802094820962 hip_t
            lame    1165886731226582744 lame_t
            mp3_buffer  "\005\0029lM^J\035�xo�R����(����Rj\172175r�V�����ԡCb٥���0a�ע�r�4�A��7Xj�Q0u�\033Os��L5�S$D2\002\016� UxCp\014s��08\004+7��@"�r"... (4096)   unsigned char[4096]
            mp3_in  0xe0b0e1e0e060d4a   FILE*
            pcm_buffer  @0x7fffffff89a0 short[8192]
            pcm_buffer1 @0x7fffffff69a0 short[4096]
            pcm_buffer2 @0x7fffffff49a0 short[4096]
            pcm_out 0xc460bb00bb40c82   FILE*
            read    229772669   int
            write    
    

    it seems this is not ID3 issue, I have used this code https://searchcode.com/file/31230698/ID3.cpp to read ID3 and it shows there is no ID3 tags But still crashing at the same point:

    Has ID3v2 Tag: No
      Tag size: 0
    start decoding skip tag_size: 0
    a message: 4096
    a message: 8192
    a message: 12288
    
  • How to create side by side two video with padding and image background using ffmpeg ?

    23 mai 2019, par ravinaSukhadiya

    Two video play same time with collageView using ffmpeg. I have code but it's not work properly please help me.

    -ss " + getStartTime()  + durationTime_act_select +getVideoUrl() +
                           " -ss " + getStartTime() +
                           " -t " + this.durationTime_act_select +
                           " -i " + getVideoUrl() +
                           " -i " + "R.jpg" +
                           " -filter_complex nullsrc=size=720*720[base1];" +
                           "[0:v]setpts=PTS-STARTPTS,scale=345*700[upperleft];" +
                           "[1:v]setpts=PTS-STARTPTS,scale=345*700[upperright];" +
                           "[2:v]setpts=PTS-STARTPTS,scale=720*720[over];" +
                           "[base1][over]overlay=shortest=1:x=0:y=0[base];"+
                           "[base][upperleft]overlay=shortest=1:x=10:y=10[tmp1];" +
                           "[tmp1][upperright]overlay=shortest=1:x=366:y=10" +
                           " -c:a copy -strict experimental -ss 0 -t " + this.durationTime_act_select + " -preset ultrafast -an " +videoName_act_select
    

    enter image description here

  • How to combine two ffmpeg commands - adding blur bar and adding logo and subtitle ?

    23 mai 2019, par Wai Gyi

    I run the following two ffmpeg command lines to create videos with blur bar, logo and subtitle.

    1. Adding blur bars

      ffmpeg -i input.mkv -lavfi "[0:v]scale=iw:iw*3/4,boxblur=luma_radius=min(h\,w)/40:luma_power=3:chroma_radius=min(cw\,ch)/40:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1,crop=h=iw*3/4" blur_bar_added.mkv  
      
    2. Adding logo and subtitle

      ffmpeg -i blur_bar_added.mkv -i logo.png -filter_complex "[1][0]scale2ref=iw*0.15:ow/mdar[wm][v];[v][wm]overlay=W-w-5:5,ass=input.ass" output.mkv
      

    I would like to know how to combine them to run once. Thanks in advance.

  • rtsp url to stream on kurento

    23 mai 2019, par damini chopra

    I have installed ffmpeg and when MP4 video is successfully running on URL:http://x.x.x.x:8050/live.mjpeg ,but when i want url(http://180.179.214.151:8050/live.mjpeg) of to display on remote stream of kurento it doesnt display any visual.

    Logs in kurento console:

    Remote icecandidate {"module":"kurento","type":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 172.17.0.2 35776 typ host","sdpMLineIndex":1,"sdpMid":"1"} Remote icecandidate {"module":"kurento","type":"IceCandidate","candidate":"candidate:3 2 TCP 1010827518 172.17.0.2 43398 typ host tcptype passive","sdpMLineIndex":1,"sdpMid":"1"} oniceconnectionstatechange -> checking icegatheringstate -> gathering Player playing ...