Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to fix that ? [duplicate]

    30 septembre 2016, par Độc Hành

    This question already has an answer here:

    Watermark short videos upload from pc working. But download video 720p from vimeo and watermark not working

      set_time_limit(0);
      $ffmpeg = FFMpeg\FFMpeg::create([
            'ffmpeg.binaries' => '/usr/bin/ffmpeg',
            'ffprobe.binaries' => '/usr/bin/ffprobe',
            'timeout' => 0, // The timeout for the underlying process
            //'ffmpeg.threads' => 12,   // The number of threads that FFMpeg should use
        ]);
         $video = $ffmpeg->open( '/var/www/webroot/ccbank/frontend/web/uploads/vimeo.mp4');
        $watermark = '/var/www/webroot/ccbank/frontend/web/uploads/logo-h100.png';
        $video->filters()->watermark($watermark, [
            'position' => 'relative',
            'right' => 50,
            'top' => 50,
        ]);
        $format = new FFMpeg\Format\Video\X264();
        $output =  '/var/www/webroot/ccbank/frontend/web/uploads/watermark1.mp4';
        $video->save($format, $output);
    

    Browser error: error1

    error command line:

    '/usr/bin/ffmpeg' '-y' '-i' '/var/www/webroot/ccbank/frontend/web/uploads/vimeo.mp4' '-vf' 'movie=/var/www/webroot/ccbank/frontend/web/uploads/logo-h100.png [watermark]; [in][watermark] overlay=main_w - 50 - overlay_w:50 [out]' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57ee9ba784e323laim/pass-57ee9ba784f92' '/var/www/webroot/ccbank/frontend/web/uploads/watermark1.mp4'
    

    Terminal:

    error2

    lib libfaac-dev ready installed How to fix that?

  • Can not set the number of channels in VideoCapture in OpenCV

    30 septembre 2016, par vkubicki

    I am trying to use OpenCV to apply treatments on an mj2 file encoded as grayscale uint16 per pixel. Unfortunately, a non disclosure agreement covers this file (which I did not generate myself) and I can not post a sample mj2 file.

    The description of my .mj2 file as provided by ffmpeg is:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'data/DEVISSAGE_181.mj2':
      Metadata:
        major_brand     : mjp2
        minor_version   : 0
        compatible_brands: mjp2
        creation_time   : 2015-10-09 08:07:43
      Duration: 00:01:03.45, start: 0.000000, bitrate: 14933 kb/s
        Stream #0:0: Video: jpeg2000 (mjp2 / 0x32706A6D), gray16le, 1152x288, lossless, 14933 kb/s, SAR 1:4 DAR 1:1, 5.50 fps, 5.50 tbr, 55 tbn, 55 tbc (default)
        Metadata:
          creation_time   : 2015-10-09 08:07:43
          handler_name    : Video
          encoder         : Motion JPEG2000
    

    I take it that gray16le confirms the uint16 encoding somehow.

    Here is my C++ code:

    #include
    
    #include "opencv2/opencv.hpp"
    
    int main(int, char**) {
        cv::VideoCapture cap("data/DEVISSAGE_181.mj2"); // open the video file
        cap.set(CV_CAP_PROP_FORMAT, CV_16UC1);
    
        cv::Mat frame;
        cap.read(frame); // get a new frame from file
    
        std::cout << "frame.rows: " << frame.rows << ", frame.cols: " << frame.cols << ", frame.channels(): " << frame.channels() << std::endl;
    
        return 0;
    }
    

    The result of running this code is:

    frame.rows: 288, frame.cols: 1152, frame.channels(): 3, frame.depth(): 0
    

    Which indicates a 3 channels, CV_8U pixel encoding. Why does the cap.set instruction appear to be ignored ? What should I do to get the correct encoding ?

  • subtitles dont show ffmpeg issue

    30 septembre 2016, par Bilal Shahid

    I'm using below command to burn subtitles to a video. I have successfully done it via terminal in ubuntu. I've used this library in android android library and I've run the same command to do the same task but it wont work the command executes successfully but in result video I don't see any subtitle.

    fmpeg -i /home/s9iper1/a.mp4 -vf "subtitles=/home/s9iper1/titles.srt:force_style='Fontsize=24,PrimaryColour=&H0000ff&'" -c:a copy /home/s9iper1/out.mp4
    
  • Capturing Video with 1:1 aspect ratio on Android

    30 septembre 2016, par Nikhil Mathew

    I am trying to develop an android app that would record a 15sec 640x640 video using MediaRecorder, extract all frames using ffmpeg, apply some artistic filters using gpuimage and then combine the frames back to a video using ffmpeg.

    I'm facing problem in recording a video of resolution 640x640. (Instagram android app does this)

    I tried using MediaRecorder's setVideoSize(640, 640) and the output video is 640x640 but the video looks like a 640x480 video stretched vertically to make it 640x640. I guess that's because 640x640 is not a resolution returned by the supported video capture resolution list of the device. Is there any way to tell media recorder to maintain aspect ratio while doing such scaling so that I get a video that was scaled from 640x480 to 640x640 by cropping width wise instead of stretching height wise ?

  • FFmpeg mp4 to m3u8 but audio not working

    30 septembre 2016, par Ravi Kumar

    Command I'm using

    ffmpeg -y -i video.mp4 -vcodec libx264 -preset superfast -r 25 -vb 240000 -s 
    426x240 -aspect 1.77 -acodec libfdk_aac -ab 128k -ar 48000 -an -g 30 -r 30 
    -hls_time 3 -hls_list_size 0 -hls_allow_cache 1 -hls_playlist_type vod 
    -bsf:a aac_adtstoasc video.m3u8
    

    output shows "no audio"

    http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Ftvfiless.com%2Fvideo.m3u8&enableStreaming=true&autoRecoverError=true&enableWorker=true&levelCapping=-1

    anyone help what's wrong in my command

    Update

    ffmpeg -i video.mp4 -c:v libx264 -c:a aac -strict -2 -f hls -hls_list_size 0 output.m3u8

    i tried this command and its working fine, generating audio with m3u8, but i want to integrate it with my above command.

    Thanks