Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Ubuntu 14.04 Install opencv3.0, meet relocation error

    30 mars 2015, par Coderzelf

    Here is my make log:

    [  3%] Built target libwebp
    [  3%] Built target opencv_cudev
    [  7%] Built target opencv_ts_pch_dephelp
    [  7%] Built target pch_Generate_opencv_ts
    [  7%] Built target opencv_core_pch_dephelp
    [  7%] Built target pch_Generate_opencv_core
    [ 11%] Built target opencv_core
    [ 11%] Built target opencv_imgproc_pch_dephelp
    [ 11%] Built target pch_Generate_opencv_imgproc
    [ 15%] Built target opencv_imgproc
    [ 15%] Built target opencv_imgcodecs_pch_dephelp
    [ 15%] Built target pch_Generate_opencv_imgcodecs
    [ 15%] Built target opencv_imgcodecs
    [ 15%] Built target opencv_videoio_pch_dephelp
    [ 15%] Built target pch_Generate_opencv_videoio
    Linking CXX shared library ../../lib/libopencv_videoio.so
    /usr/bin/ld: /usr/local/lib/libavformat.a(rmsipr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libavformat.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status
    make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
    make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
    make: *** [all] Error 2
    

    I tried to re-build ffmpeg from source, in the beginning, make in ffmpeg meets similiar problem but after I configure using this command:

    ./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-outdev=sdl --disable-opencl --enable-libmp3lame --enable-libx264 --cc="gcc -m64 -fPIC" --extra-cflags="-I../include" --extra-ldflags="-L../lib -ldl"
    

    the ffmpeg is built.

    But the opencv make error is still there..

    Searched a lot and cannot find a solution.

  • Use hadoop to fastly encode my videos

    30 mars 2015, par wanna know

    I'm developping a VOD plateform which get videos with the size > 2Gb so the conversion take too long and i want to use hadoop and ffmpeg to fastly encode my videos , is that possible? Thank you

  • Gstreamer + Logitech C920 h264 video lacks timing information, plus mp4mux not working

    30 mars 2015, par user1048388

    I'm currently getting the h264 encoded video and the audio from the C920 via gstreamer 1.2.4 :

    gst-launch-1.0 v4l2src device=/dev/video0 do_timestamp=true ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! muxout. pulsesrc device="alsa_input.usb-046d_HD_Pro_Webcam_C920_5530335F-02-C920.analog-stereo" ! queue ! audioconvert ! voaacenc bitrate=65536 ! muxout. matroskamux name=muxout streamable=true ! queue ! filesink location=/home/[omitted]/test.mp4 
    

    The main problem is that the resulting video lacks timing information. By that I mean seek is not possible and the duration is unknown. Adding do_timestamp=true changes nothing. Simply copying the file in ffmpeg/libav shows several instances of:

    Non-monotonous DTS in output stream 0:0; previous: 926, current: 807; changing to 927. This may result in incorrect timestamps in the output file.

    After this short process (seconds on an hour long file), the timing information suddenly works for the entire video.

    What do I need to do to make this happen during the gst-launch pipeline?

    There are some other problems which may or may not be related: I am using matroskamux despite wanting a mp4 container because mp4mux simply does not work in the given launch command. I receive

    ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot identify device '/dev/video0'. Additional debug info: v4l2_calls.c(568): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: system error: No such file or directory

    when replacing matroskamux with mp4mux.

    I am clueless as to why this happens. Any help would be appreciated.

  • cutting video with ffmpeg

    30 mars 2015, par Pavel K.

    i am trying to cut out 2.33 seconds slice out of a video.

    $ ffmpeg -ss 5177.13 -i /temp/1427026144.mp4 -t 2.33 -c copy -avoid_negative_ts 1 testslice.mp4
    
    ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
      built on Oct 20 2014 16:56:19 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
      configuration: --prefix=/home/vagrant/ffmpeg_build --extra-cflags=-I/home/vagrant/ffmpeg_build/include --extra-ldflags=-L/home/vagrant/ffmpeg_build/lib --bindir=/home/vagrant/bin --enable-gpl --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libfdk_aac --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-pthreads --enable-nonfree
      libavutil      54. 10.100 / 54. 10.100
      libavcodec     56.  8.102 / 56.  8.102
      libavformat    56.  9.101 / 56.  9.101
      libavdevice    56.  1.100 / 56.  1.100
      libavfilter     5.  1.106 /  5.  1.106
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/temp/1427026144.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.9.101
      Duration: 02:00:05.25, start: 0.000000, bitrate: 385 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 450x360 [SAR 1:1 DAR 5:4], 256 kb/s, 12 fps, 12 tbr, 12288 tbn, 24 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
    Output #0, mp4, to 'testslice.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.9.101
        Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 450x360 [SAR 1:1 DAR 5:4], q=2-31, 256 kb/s, 12 fps, 12288 tbn, 12288 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 125 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=  156 fps=0.0 q=-1.0 Lsize=     583kB time=00:00:02.34 bitrate=2031.7kbits/s    
    video:377kB audio:199kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.198143%
    

    now i try to see information about the slice

    $ ffprobe testslice.mp4 
    ffprobe version 2.4.git Copyright (c) 2007-2014 the FFmpeg developers
      built on Oct 20 2014 16:56:19 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
      configuration: --prefix=/home/vagrant/ffmpeg_build --extra-cflags=-I/home/vagrant/ffmpeg_build/include --extra-ldflags=-L/home/vagrant/ffmpeg_build/lib --bindir=/home/vagrant/bin --enable-gpl --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libfdk_aac --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-pthreads --enable-nonfree
      libavutil      54. 10.100 / 54. 10.100
      libavcodec     56.  8.102 / 56.  8.102
      libavformat    56.  9.101 / 56.  9.101
      libavdevice    56.  1.100 / 56.  1.100
      libavfilter     5.  1.106 /  5.  1.106
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testslice.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.9.101
      Duration: 00:00:13.00, start: 0.000000, bitrate: 367 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 450x360 [SAR 1:1 DAR 5:4], 237 kb/s, 12 fps, 12 tbr, 12288 tbn, 24 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
    

    why is resulting slice 13 seconds long (i need 2.33 seconds)?

  • Compress video with ffmpeg4android library

    30 mars 2015, par Huy Tower

    I tried to follow ffmpeg4android library, and I get the problem when compressing the video, as the Log image below.

    I use intent to transfer to Compressing Media class,

    Intent intent = new Intent(this, CompressingMedia.class);
    intent.putExtra("file_path", mLlItems.get(0).getPath());
    startActivity(intent);
    

    This is the class was transfered to :

    public class CompressingMedia extends BaseWizard {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        Intent intent = getIntent();
    
        Log.d(Prefs.TAG, "path " + intent.getExtras().getString("file_path"));
        // /storage/emulated/0/DCIM/Camera/VID_20140312_090612.mp4
    
        String command = "ffmpeg -y -i " + intent.getExtras().getString("file_path") + 
                " -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/out.mp4";
    
        // if you want to change the default work location (/sdcard/videokit/) use the uncomment the below method.
        // It must be defined before calling the copyLicenseAndDemoFilesFromAssetsToSDIfNeeded method,
        // in order for this method to copy the assets to the correct location.
                //      setWorkingFolder("/sdcard/videokit/");
    
        // this will copy the license file and the demo video file.
        // to the videokit work folder location.
        // without the license file the library will not work.
        copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();
    
        commandStr = command;
        setCommand(commandStr);
    
        runTranscoing();
        }
    }
    

    Although I received the notification Transcoding Successfully, but it looks like the capacity of file after compressing is always be 0. (the log in the bottom of images)

    I don't know the result as image below is good or not, I can not get the expected result - The video was compressed totally successfully.

    Someone know why after compressing the file is always be 0, please tell me. Thanks.

    This is the Log Cat :

    03-13 14:49:45.655: I/ActivityManager(6065): Timeline: Activity_launch_request id:app.cloudstringers time:38212359

    03-13 14:49:45.665: V/Home(6065): Global ID is 000400010007;Sell is 3

    03-13 14:49:45.770: D/ffmpeg4android(6065): path /storage/emulated/0/videokit/out.mp4

    03-13 14:49:45.770: I/ffmpeg4android(6065): workingFolderPath: /sdcard/videokit/

    03-13 14:49:45.775: D/ffmpeg4android(6065): Working directory exists, not coping assests (license file and demo videos)

    03-13 14:49:45.785: D/ffmpeg4android(6065): output directory exists.

    03-13 14:49:45.785: I/ffmpeg4android(6065): Command is set

    03-13 14:49:45.785: I/ffmpeg4android(6065): set remoteNotificationIconId: 0

    03-13 14:49:45.785: D/ffmpeg4android(6065): Client Cannot unbind - service not bound

    03-13 14:49:45.785: D/ffmpeg4android(6065): Client stopService()

    03-13 14:49:45.790: W/ContextImpl(6065): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.stopService:499 com.netcompss.ffmpeg4android_client.BaseWizard.stopService:451 com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:285

    03-13 14:49:45.795: I/ffmpeg4android(6065): !!!!!!!!!!!!!!!!!!services.size(): 1

    03-13 14:49:45.795: I/ffmpeg4android(6065): putting Base categoty

    03-13 14:49:45.810: D/ffmpeg4android(6065): started: com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge

    03-13 14:49:45.810: D/ffmpeg4android(6065): Client startService()

    03-13 14:49:45.810: D/ffmpeg4android(6065): bindService() called

    03-13 14:49:45.815: W/ContextImpl(6065): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.bindService:517 com.netcompss.ffmpeg4android_client.BaseWizard.bindService:462 com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:288

    03-13 14:49:45.820: D/ffmpeg4android(6065): Client bindService()

    03-13 14:49:45.935: I/ffmpeg4android(6616): =======service onCreate(): Stopping forground (to overcome 2.3.x bug)

    03-13 14:49:45.935: I/ffmpeg4android(6616): =======service onBind()=======

    03-13 14:49:45.940: I/ffmpeg4android(6616): ===onStartCommand called

    03-13 14:49:45.940: I/ffmpeg4android(6616): ===onStartCommand cat: Base

    03-13 14:49:45.940: D/ffmpeg4android(6616): onStartCommand, START_STICKY, base Command

    03-13 14:49:45.955: I/ffmpeg4android(6616): get remoteNotificationIconId: 0

    03-13 14:49:45.955: I/ffmpeg4android(6616): notifIcon is set

    03-13 14:49:45.955: I/ffmpeg4android(6616): Start RemoteService with notification id: 5326

    03-13 14:49:45.965: I/ffmpeg4android(6616): Run called.

    03-13 14:49:45.965: D/ffmpeg4android(6616): Sleeping, waiting for command

    03-13 14:49:45.970: D/ffmpeg4android(6065): Client onServiceConnected()

    03-13 14:49:45.970: I/ffmpeg4android(6065): invokeService called

    03-13 14:49:45.970: I/Videokit(6065): licenseCheck in path: /sdcard/videokit

    03-13 14:49:45.970: I/Videokit(6065): isLicExistsComplex...

    03-13 14:49:45.970: I/Videokit(6065): trying to open /sdcard/videokit/ffmpeglicense.lic

    03-13 14:49:45.970: I/Videokit(6065): license file found...

    03-13 14:49:45.970: I/Videokit(6065): time decoded: 1394535283

    03-13 14:49:45.970: I/Videokit(6065): timeStrDec 1394535283 is a valid number.

    03-13 14:49:45.970: I/Videokit(6065): time diff: 161702

    03-13 14:49:45.970: I/Videokit(6065): You used 1 of your 15 trial days.

    03-13 14:49:45.970: I/ffmpeg4android(6065): setting remote notification info

    03-13 14:49:45.970: D/ffmpeg4android(6616): command items num: 21

    03-13 14:49:45.970: D/ffmpeg4android(6616): command: ffmpeg -y -i /storage/emulated/0/videokit/out.mp4 -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/out.mp4

    03-13 14:49:45.970: D/ffmpeg4android(6616): workingFolder from remote: /sdcard/videokit

    03-13 14:49:45.970: D/ffmpeg4android(6065): deleteing: /sdcard/videokit/vk.log isdeleted: true

    03-13 14:49:45.975: D/ffmpeg4android(6065): deleteing: /sdcard/videokit/ffmpeg4android.log isdeleted: false

    03-13 14:49:45.975: D/ffmpeg4android(6065): deleteing: /sdcard/videokit/videokit.log isdeleted: true

    03-13 14:49:45.980: D/ffmpeg4android(6065): Client invokeService()

    03-13 14:49:45.980: D/ffmpeg4android(6065): Acquire wake lock

    03-13 14:49:46.265: D/ffmpeg4android(6616): Sleeping, waiting for command

    03-13 14:49:46.295: D/ffmpeg4android(6065): TranscodeBackground doInBackground started

    03-13 14:49:46.295: I/ffmpeg4android(6616): =======remote service runTranscoding ======

    03-13 14:49:46.340: V/HomeAsync(6065): TOTAL_SPACE is 1;AVAILABLE_SPACE is 0.451

    03-13 14:49:46.345: I/ActivityManager(6065): Timeline: Activity_idle id: android.os.BinderProxy@423deed8 time:38213045

    03-13 14:49:46.345: I/ActivityManager(6065): Timeline: Activity_idle id: android.os.BinderProxy@420323a0 time:38213045

    03-13 14:49:46.565: D/dalvikvm(6616): Trying to load lib /data/app-lib/app.cloudstringers-2/libvideokit.so 0x41b285f0

    03-13 14:49:46.570: D/dalvikvm(6616): Added shared lib /data/app-lib/app.cloudstringers-2/libvideokit.so 0x41b285f0

    03-13 14:49:46.570: I/Videokit(6616): Loading native library compiled at 21:59:53 Oct 23 2013

    03-13 14:49:46.575: I/ffmpeg4android(6616): ===============Running command from thread path: /sdcard/videokit

    03-13 14:49:46.575: I/Videokit(6616): vk ffmpeg sdcardPath: /sdcard/videokit

    03-13 14:49:46.575: I/Videokit(6616): licenseCheck in path: /sdcard/videokit

    03-13 14:49:46.575: I/Videokit(6616): isLicExistsComplex...

    03-13 14:49:46.575: I/Videokit(6616): trying to open /sdcard/videokit/ffmpeglicense.lic

    03-13 14:49:46.575: I/Videokit(6616): license file found...

    03-13 14:49:46.575: I/ffmpeg4android(6616): =======ProgressBackgroundRemote doInBackground=========

    03-13 14:49:46.575: I/Videokit(6616): time decoded: 1394535283

    03-13 14:49:46.575: I/Videokit(6616): timeStrDec 1394535283 is a valid number.

    03-13 14:49:46.575: I/Videokit(6616): time diff: 161703

    03-13 14:49:46.575: I/Videokit(6616): You used 1 of your 15 trial days.

    03-13 14:49:46.575: D/Videokit(6616): license check rc: 0

    03-13 14:49:46.575: D/Videokit(6616): run() called verion 2.0

    03-13 14:49:46.575: D/Videokit(6616): run passing off to main()

    03-13 14:49:46.800: D/ffmpeg4android(6065): onServiceDisconnected

    03-13 14:49:48.640: I/ffmpeg4android(6065): Got real duration: 00:00:07.78

    03-13 14:49:48.640: I/ffmpeg4android(6065): ==== getting currentVkLogSize from VK

    03-13 14:49:48.640: D/ffmpeg4android(6065): currentVkLogSize: 5751

    03-13 14:49:48.645: I/ffmpeg4android(6065): No ffmpeg4android_log file, using vk log

    03-13 14:49:48.645: I/line(6065): _rate, rate, width or height

    03-13 14:49:48.650: I/line(6065): Statistics: 0 seeks, 0 writeouts

    03-13 14:49:48.650: I/line(6065): Statistics: 72873 bytes read, 2 seeks

    03-13 14:49:48.650: D/ffmpeg4android(6065): currentTimeStr: exit

    03-13 14:49:48.650: D/ffmpeg4android(6065): ============Found one of the exit tokens in the log============

    03-13 14:49:48.650: I/ffmpeg4android(6065): onProgressUpdate: 100

    03-13 14:49:48.650: D/ffmpeg4android(6065): Releasing wake lock

    03-13 14:49:48.650: D/ffmpeg4android(6065): TranscodeBackground onPostExecute

    03-13 14:49:48.700: D/ffmpeg4android(6065): /sdcard/videokit/null length in bytes: 0

    03-13 14:49:48.700: D/ffmpeg4android(6065): showNotifications

    03-13 14:49:48.700: W/ffmpeg4android(6065): output file is not set use the setOutputFilePath method to set the full output file path

    03-13 14:49:48.705: I/ffmpeg4android(6065): FFMPEG finished.

    03-13 14:49:48.710: D/ffmpeg4android(6065): releaseService()

    03-13 14:49:48.710: D/ffmpeg4android(6065): Client stopService()

    03-13 14:49:48.710: W/ContextImpl(6065): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.stopService:499 com.netcompss.ffmpeg4android_client.BaseWizard.stopService:451 com.netcompss.ffmpeg4android_client.BaseWizard.handleServiceFinished:513