Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Using ffmpeg to extract multiple images from video and get timestamp of extracted images

    2 avril 2015, par jogal

    I'm using ffmpeg to extract one frame (as a jpeg) every five minutes from videos, and piping the output from the console to a text file in order to get the exact timestamps of the extracted frames.

    The command I'm using is:

    ffmpeg -i input.avi -ss 00:10:00 -vframes 10 -vf showinfo,fps=fps=1/300 %03d.jpg &> output.txt
    

    Where -ss 00:10:00 lets me skip ahead 10 mins in the video before starting, and -vframes 10 lets me capture only the first 10 frames (1 frame per 5 mins).

    This almost works fine except that the command outputs information for all frames, including those that were not written as a jpeg. Here's a three line sample output:

    [Parsed_showinfo_0 @ 0x2219020] n:11427 pts:11429 pts_time:599.979 pos:48892180 fmt:yuv420p sar:1/1 s:640x480 i:P iskey:0 type:P checksum:6309A75D plane_checksum:[15A29007 1617E1FE D93A3549] mean:[146 125 153 ] stdev:[17.6 1.0 2.1 ]
    [Parsed_showinfo_0 @ 0x2219020] n:11428 pts:11430 pts_time:600.031 pos:48898094 fmt:yuv420p sar:1/1 s:640x480 i:P iskey:0 type:B checksum:815D031A plane_checksum:[E004E973 E28CE2D5 F56636B4] mean:[146 125 153 ] stdev:[17.6 1.0 2.1 ]
    [Parsed_showinfo_0 @ 0x2219020] n:11429 pts:11431 pts_time:600.084 pos:48892448 fmt:yuv420p sar:1/1 s:640x480 i:P iskey:0 type:P checksum:6CE2D3C5 plane_checksum:[E983BD86 38B9E198 93B13498] mean:[146 125 153 ] stdev:[17.6 1.0 2.1 ]
    

    I would expect the middle line, with pts_time:600.031, to be the first frame extracted as an image, but have no way to distinguish it from the other frames either side, where images were not extracted.

    Does anyone know of a way to resolve this?

    Thank you!

  • mixing frame rates to create one video

    2 avril 2015, par taglius

    I have successfully extracted two videos to .bmp files, one is 30 frames per second, the other is 60. I want to combine them into a single video that plays both clips smoothly at 60fps. If necessary, I have the ability to duplicate the frames of the 30fps video while extracting, which is what I tried in my first attempt. The following is what I have tried to this point, having doubled frames for the 30fps:

    ffmpeg.exe -i output_%%05d.bmp -r 60 -c:v libx264 -vf "setpts=0.5*PTS" -pix_fmt yuv420p out.mp4
    

    The resulting file is 60fps, but the video appears to be at around 80-90% speed. During encoding, there are a number of yellow warning messages that read Past duration 0.999992 too large (some of the messages are 0.799995, the rest are 0.999992).

  • Using FFMpeg to concat, overlay and add text

    2 avril 2015, par Jean-Philippe Encausse

    FFMpeg is really powerfull and cross-platform. Is it also faster than code ?

    I'd like to perform the following task in one pass:

    1. Take a file F1.avi ... FN.avi
    2. Add a Text overlay T1 ... TN
    3. Add an overlay image
    4. Concat all these files in Fout.avi

    Is it possible to do all these things in one shot ?

    • It seems complicated to write a text according to a given file

    I Write a little C# application using a JSON Config but would love a clean FFMpeg option.

  • ffmpeg for Android build shows error

    2 avril 2015, par Jamal

    I would like to build ffmpeg for Android so I am following a steps from this tutorial http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/

    What I tried

    1. downloaded android-ndk-r10d-darwin-x86_64.bin for Mac 64 bit OS
    2. decompressed/extract the NDK archieve file
    3. downloaded ffmpeg 2.6.1
    4. decompressed/extract the `ffmpeg 2.6.1 file
    5. copied the ffmpeg 2.6.1 extracted folder and pasted into android-ndk-r10d/sources/ location
    6. Opened the ffmpeg-2.6.1/configure file and replaced this code

      SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)' SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'

    with

    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
    LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
    SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
    SLIB_INSTALL_LINKS='$(SLIBNAME)'
    

    7.Created the build_android.shfile inside ffmpeg-2.6.1 folder so now it be like this ffmpeg-2.6.1/build_android.sh.
    instead of this NDK=$HOME/Desktop/adt/android-ndk-r9 line I set current NDK location
    8. executed this sudo chmod +x build_android.sh command

    1. while executing this command ./build_android.sh got below error

    Hubs-Mac-mini:ffmpeg-2.6.1 hubmaci7$ ./build_android.sh Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1 Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1 /hubmaci7/Pictures/Hubino/Jamal/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc is unable to create an executable file. C compiler test failed.

    If you think configure made a mistake, make sure you are using the latest
    version from Git.  If the latest version fails, report the problem to the
    ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
    Include the log file "config.log" produced by configure as this will help
    solve the problem.
    Makefile:2: config.mak: No such file or directory
    Makefile:59: /common.mak: No such file or directory
    Makefile:100: /libavutil/Makefile: No such file or directory
    Makefile:100: /library.mak: No such file or directory
    Makefile:102: /doc/Makefile: No such file or directory
    Makefile:185: /tests/Makefile: No such file or directory
    make: *** No rule to make target `/tests/Makefile'.  Stop.
    Makefile:2: config.mak: No such file or directory
    Makefile:59: /common.mak: No such file or directory
    Makefile:100: /libavutil/Makefile: No such file or directory
    Makefile:100: /library.mak: No such file or directory
    Makefile:102: /doc/Makefile: No such file or directory
    Makefile:185: /tests/Makefile: No such file or directory
    make: *** No rule to make target `/tests/Makefile'.  Stop.
    Makefile:2: config.mak: No such file or directory
    Makefile:59: /common.mak: No such file or directory
    Makefile:100: /libavutil/Makefile: No such file or directory
    Makefile:100: /library.mak: No such file or directory
    Makefile:102: /doc/Makefile: No such file or directory
    Makefile:185: /tests/Makefile: No such file or directory
    make: *** No rule to make target `/tests/Makefile'.  Stop.
    Hubs-Mac-mini:ffmpeg-2.6.1 hubmaci7$ 
    

    please provide a needed solution for me to solve this errors

  • insert video in video ffmpeg at time exact

    2 avril 2015, par Ti Amo Laky

    I have Video out.mp4 have 30 sec I want to put new video image1.mp4 have 5 sec in out.mp4 at 10 seconds i have this code to put my image1.mp4 in out.mp4

    ffmpeg -i F:\out.mp4  -vf "movie=image2.mp4 , scale=200:-1,fade=out:200:alpha=1 , [inner]; [in][inner] overlay=70:70 [out]"  -c:v libx264  -s "1080x720" completed.mp4
    

    the output

        >ffmpeg -i F:\out.mp4 -vf "movie=image2.mp4 , scale=200:-1,fade=out:100:alpha=1
     [inner]; [in][inner] overlay=70:70 [out]"  completed.mp4
    ffmpeg version N-70411-g7da7d26 Copyright (c) 2000-2015 the FFmpeg developers
      built with gcc 4.9.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
    modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
    b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
    r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
    able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
     --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
    libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
    le-zlib
      libavutil      54. 19.100 / 54. 19.100
      libavcodec     56. 26.100 / 56. 26.100
      libavformat    56. 24.101 / 56. 24.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 11.102 /  5. 11.102
      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 'F:\out.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.24.101
      Duration: 00:00:16.67, start: 0.000000, bitrate: 309 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x640 [
    SAR 1:1 DAR 5:4], 306 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
        Metadata:
          handler_name    : VideoHandler
    [swscaler @ 0000000005608ea0] deprecated pixel format used, make sure you did se
    t range correctly
    [libx264 @ 0000000002c1c3a0] using SAR=1/1
    [libx264 @ 0000000002c1c3a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0000000002c1c3a0] profile High, level 3.1
    [libx264 @ 0000000002c1c3a0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC cod
    ec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 r
    ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
    _ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
    p=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 deci
    mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
    adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2
    5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
    0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'completed.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.24.101
        Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 8
    00x640 [SAR 1:1 DAR 5:4], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
        Metadata:
          handler_name    : VideoHandler
          encoder         : Lavc56.26.100 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   68 fps=0.0 q=29.0 size=      96kB time=00:00:00.63 bitrate=1245.6kbits/
    frame=  111 fps=107 q=29.0 size=     161kB time=00:00:02.06 bitrate= 637.5kbits/
    frame=  155 fps=100 q=29.0 size=     222kB time=00:00:03.53 bitrate= 514.3kbits/
    frame=  212 fps=103 q=29.0 size=     270kB time=00:00:05.43 bitrate= 406.5kbits/
    frame=  270 fps=105 q=29.0 size=     292kB time=00:00:07.36 bitrate= 324.9kbits/
    frame=  314 fps=102 q=29.0 size=     465kB time=00:00:08.83 bitrate= 431.6kbits/
    frame=  382 fps=106 q=29.0 size=     569kB time=00:00:11.10 bitrate= 420.0kbits/
    frame=  461 fps=112 q=29.0 size=     597kB time=00:00:13.73 bitrate= 356.2kbits/
    frame=  500 fps=107 q=-1.0 Lsize=     629kB time=00:00:16.60 bitrate= 310.3kbits
    /s
    video:623kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
    verhead: 0.984177%
    [libx264 @ 0000000002c1c3a0] frame I:3     Avg QP:15.65  size: 90538
    [libx264 @ 0000000002c1c3a0] frame P:190   Avg QP:21.18  size:  1663
    [libx264 @ 0000000002c1c3a0] frame B:307   Avg QP:30.53  size:   161
    [libx264 @ 0000000002c1c3a0] consecutive B-frames: 18.0%  0.0%  1.2% 80.8%
    [libx264 @ 0000000002c1c3a0] mb I  I16..4: 17.4% 72.4% 10.2%
    [libx264 @ 0000000002c1c3a0] mb P  I16..4:  0.0%  0.3%  0.2%  P16..4:  5.0%  1.3
    %  0.9%  0.0%  0.0%    skip:92.2%
    [libx264 @ 0000000002c1c3a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  2.1%  0.3
    %  0.1%  direct: 0.1%  skip:97.4%  L0:39.2% L1:52.6% BI: 8.2%
    [libx264 @ 0000000002c1c3a0] 8x8 transform intra:68.7% inter:65.2%
    [libx264 @ 0000000002c1c3a0] coded y,uvDC,uvAC intra: 79.0% 49.6% 23.6% inter: 1
    .1% 1.6% 0.2%
    [libx264 @ 0000000002c1c3a0] i16 v,h,dc,p: 92%  5%  1%  2%
    [libx264 @ 0000000002c1c3a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19%  8% 22%  7%  8%
    12%  5% 13%  6%
    [libx264 @ 0000000002c1c3a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 18% 16%  5%  6%
     8%  6%  7%  6%
    [libx264 @ 0000000002c1c3a0] i8c dc,h,v,p: 63% 16% 18%  3%
    [libx264 @ 0000000002c1c3a0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0000000002c1c3a0] ref P L0: 59.0% 18.1% 17.1%  5.8%
    [libx264 @ 0000000002c1c3a0] ref B L0: 83.8% 11.7%  4.5%
    [libx264 @ 0000000002c1c3a0] ref B L1: 96.5%  3.5%
    [libx264 @ 0000000002c1c3a0] kb/s:305.76