Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Opus Audio Codec in Linphone Android 2013 Version

    2 septembre 2015, par Redturbo

    I want to just enabled Opus Audio Codec in my VOIP application, I have try code from here : http://stackoverflow.com/questions/31635522/force-using-just-opus-codec-in-linphone-android/31652551#31652551

    I try to check findpayloadtype first:

    for (PayloadType pt : mLc.getAudioCodecs()) {
                    pt = mLc.findPayloadType("PCMA", 8000, 1);
                    Log.d("LinphoneManager", "PayloadType PCMA : " + pt);
                }
    
                for (PayloadType pt : mLc.getAudioCodecs()) {
                    pt = mLc.findPayloadType("PCMU", 8000, 1);
                    Log.d("LinphoneManager","PayloadType PCMU : "+pt);
                }
    
                for (PayloadType pt : mLc.getAudioCodecs()) {
                    pt = mLc.findPayloadType("OPUS", 8000, 1);
                    Log.d("LinphoneManager","PayloadType P : "+pt);
    
                }
    

    PCMA and PCMU show value in log :

    [PCMA] clock [8000], bitrate [64000]

    [PCMU] clock [8000], bitrate [64000]

    but OPUS show null value :

    null

    is that something wrong with my code to got OPUS audio codec, or something else ?

  • ffmpeg taking time to convert video

    2 septembre 2015, par sonam Sharma

    hello all i am having a video hosting site like youtube where i allow almost all kinds of videos to be uploaded but i would like to convert all the uploaded videos to mp4 format

    i can do this and my code is below

      require 'vendor/autoload.php';
            $getEXT_check=substr(@$_FILES['profileimage99']['name'],-3);
            if($getEXT_check !='mp4' || $getEXT_check !='MP4'){
            exec('ffmpeg -i '.$uploadfile.' -f mp4 -s 896x504 '.$new_flv.''); }
            //execute ffmpeg and create thumb
            exec('ffmpeg  -i '.$uploadfile.' -ss 00:00:28.435 -vframes 1  '.$new_image_path);
            $theduration=exec('ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 '.$uploadfile.' 2>&1');
            $theduration_val=round($theduration/60, 2);
    

    this code converts the non mp4 videos to mp4 and gets a thumbnail and gets duration correctly but the problem is that the process takes very much time like more than 2-3 hrs if i upload flv or mkv formats of about 100mbs.

    please suggest me something better please if you need to see the full page code

    Complete Code:

         <?php
        @session_start();
       include "conn.php";
        include "date.php";
       $sid = $_SESSION['id'];
       $ipIP=$_SERVER['REMOTE_ADDR'];
       $uploaddir = "members/$sid/video/";
    
         //Check the file is of correct format.  
          function checkfile($input){
          $ext = array('mpg', 'wma', 'mov', 'flv', 'mp4', 'avi', 'qt', 'wmv', 'rm', 'mkv', 'MP4','3gp');
          $extfile = substr($input['name'],-4);
          $extfile = explode('.',$extfile);
            $good = array();
          @$extfile = $extfile[1];
         if(in_array($extfile, $ext)){
         $good['safe'] = true;
         $good['ext'] = $extfile;
         }else{
          $good['safe'] = false;
           }
          return $good;
             }
           if($_FILES["profileimage99"]["size"] ==''){
         echo 'No file added';die;
            }
      // if the form was submitted process request if there is a file for uploading
       if(@$_FILES["profileimage99"]["size"] < 102400000000){
       //$live_dir is for videos after converted to mp4
        $live_dir = "mem/$sid/video/";
      //$live_img is for the first frame thumbs.
        $live_img = "mem/$sid/img/";        
        $seed = rand(11111111111193,9999999999999929) * rand(3,9);
        $getEXT=substr(@$_FILES['profileimage99']['name'],-5);
        $upload = $seed.$getEXT;
        $uploadfile = $uploaddir .$upload;        
    
        $safe_file = checkfile(@$_FILES['profileimage99']);
        if($safe_file['safe'] == 1){
                    if (move_uploaded_file(@$_FILES['profileimage99']['tmp_name'], $uploadfile)) {
    
                    $base = basename($uploadfile, $safe_file['ext']);
                    $new_file = $base.'mp4';
                    $new_image = $base.'jpg';
                    $new_image_path = $live_img.$new_image;
                    $new_flv = $live_dir.$new_file;
    
            require 'vendor/autoload.php';
            $getEXT_check=substr(@$_FILES['profileimage99']['name'],-3);
            if($getEXT_check !='mp4' || $getEXT_check !='MP4'){
            exec('ffmpeg -i '.$uploadfile.' -f mp4 -s 896x504 '.$new_flv.''); }
            //execute ffmpeg and create thumb
            exec('ffmpeg  -i '.$uploadfile.' -ss 00:00:28.435 -vframes 1  '.$new_image_path);
            $theduration=exec('ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 '.$uploadfile.' 2>&1');
            $theduration_val=round($theduration/60, 2);
        //create query to store video
        if(isset($_POST['title'])){$titlename=$_POST['title'];}else{$titlename='';}
        if(isset($_POST['desc'])){$desc=$_POST['desc'];}else{$desc='';}
        if(isset($_POST['catag'])){$catag=$_POST['catag'];}else{$catag='';}
        if(isset($_POST['channel'])){$channel=$_POST['channel'];}else{$channel='';}
        $dbentry_o=mysqli_query($conn,"insert into vids (uid,chid,ctid,vname,vdisc,duration,time,ip,src,thumb) values ('$sid','$channel','$catag','$titlename','$desc','$theduration_val','$date','$ipIP','$new_file','$new_image')");
        echo "";die;
             } else {
                    echo "Possible file upload attack!\n";
                    print_r($_FILES);
             }
    
        }else{
    
             echo 'Invalid File Type Please Try Again. You file must be of type 
             .mpg, .wma, .mov, .flv, .mp4, .avi, .qt, .wmv, .rm'.$_FILES['profileimage99']['name'];
    
        }
      }else{
     echo 'Please choose a video';die;
      }
      ?>
    

    The issue:
    FFmpeg call above takes too much time to convert the video to MP4.

    Note:
    In the future I will be having a quality selector in my video.js player.

  • How to set frame encoding method as CABAC in ffmpeg

    2 septembre 2015, par Erfan

    I'm trying to encode video frames into H264 format using ffmpeg in C. While configuring the encoder properties I don't see how to set the frame encoding method as CABAC (lossless). Any idea?

    Thanks in advance.

  • Extracting image frames from mjpeg given 'frame byte offset' and 'frame size' [on hold]

    2 septembre 2015, par Sonia

    I'm looking for code or pointers to funtions or library that I can use to extract image frames from motion jpeg file. In my case, for each image frame, I know the starting byte offset and the size of the frame (size is not always equal for each frame). Given these data, how can I extract each image frames from mjpeg file.

    I have checked the OpenCV library, I can't find the detail about giving these two inputs to extract frames. Also, I can't find it in FFmpeg as well. But, I'm not an expert in these two. I hope anyone could give me pointers to this. It can be just a tool or sourcecode (I use C/C++ and MATLAB but I'm open to other language - just to learn how to do it)

    Thank you very much.

  • Find bytes range of webm video for specified segment

    2 septembre 2015, par M2sh

    I have a Video in webm format (like video.webm the duration is 60 seconds)
    I want to get specified segment of video (i.e split video) with http header range (Range: 100-200).
    In an other word :
    I want to get a section of video (e.g. from second 4 to 12) but i don't want to use any converter like ffmpeg. i want to send http request to server & get specified range of webm file.

    Can i use this method (http range header)?

    Thanks