Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg : error on large input file [duplicate]

    1er octobre 2016, par ingenious

    This question already has an answer here:

    I have a large Mov file with this info:

    enter image description here

    I want convert it to mp4 by this ffmpeg command:

    ffmpeg -i 57d5092f59418.mov -codec:v libx264 -profile:v high -preset slow 
    -b:v 360k -maxrate 424k -bufsize 720k -vf scale=-1:360 -threads 0 -b:a 64k
    out.mov
    

    But I get this error:

    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    detail :

            ffmpeg version N-81784-g92de2c2 Copyright (c) 2000-2016 the FFmpeg developers
          built with gcc 5.4.0 (GCC)
          configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dx
        va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-lib
        ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --ena
        ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
        type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enab
        le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
        openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschr
        oedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheor
        a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvo
        rbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --ena
        ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --e
        nable-decklink --enable-zlib
          libavutil      55. 30.100 / 55. 30.100
          libavcodec     57. 58.100 / 57. 58.100
          libavformat    57. 51.100 / 57. 51.100
          libavdevice    57.  0.102 / 57.  0.102
          libavfilter     6. 63.100 /  6. 63.100
          libswscale      4.  1.100 /  4.  1.100
          libswresample   2.  2.100 /  2.  2.100
          libpostproc    54.  0.100 / 54.  0.100
        Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '57d5092f59418.mov':
          Metadata:
            major_brand     : qt
            minor_version   : 537199360
            compatible_brands: qt
            creation_time   : 2016-02-09T07:33:27.000000Z
          Duration: 00:00:13.71, start: 0.000000, bitrate: 72247 kb/s
            Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra, 1920x1080, 72242 k
        b/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
            Metadata:
              creation_time   : 2016-02-09T07:33:27.000000Z
              handler_name    : Apple Alias Data Handler
              encoder         : Animation
              timecode        : 00:00:08;17
            Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
            Metadata:
              creation_time   : 2016-02-09T07:33:46.000000Z
              handler_name    : Apple Alias Data Handler
              timecode        : 00:00:08;17
        File 'out.mov' already exists. Overwrite ? [y/N] y
        No pixel format specified, yuv444p for H.264 encoding chosen.
        Use -pix_fmt yuv420p for compatibility with outdated media players.
        x264 [error]: high profile doesn't support 4:4:4
        [libx264 @ 00000000006f2f20] Error setting profile high.
        [libx264 @ 00000000006f2f20] Possible profiles: baseline main high high10 high42
        2 high444
        Output #0, mov, to 'out.mov':
          Metadata:
            major_brand     : qt
            minor_version   : 537199360
            compatible_brands: qt
            Stream #0:0(eng): Video: h264, none, q=2-31, SAR 1:1 DAR 0:0, 29.97 fps (def
        ault)
            Metadata:
              creation_time   : 2016-02-09T07:33:27.000000Z
              handler_name    : Apple Alias Data Handler
              timecode        : 00:00:08;17
              encoder         : Lavc57.58.100 libx264
        Stream mapping:
          Stream #0:0 -> #0:0 (qtrle (native) -> h264 (libx264))
        Error while opening encoder for output stream #0:0 - maybe incorrect parameters
        such as bit_rate, rate, width or height
    

    What shoud I do?

    thanks

  • 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 ?