Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to use ffmpeg binary in android ?

    6 novembre 2013, par cjose3

    I want make a video from images. I see in some posts (Using FFmpeg with Android-NDK, Create a Video file from images using ffmpeg images-using-ffmpeg) That use command line, is the best choice?? it's possible?

    How are build ffmpeg.so? How I can add to the project?

    This is the command that pretenfi use:

    ffmpeg -r 1 -pattern_type glob -i '*.jpg' out.mp4
    

    thanks very much. I have 2 weeks search!

    Sorry for my English.

  • correctly escaping text in drawtext filter

    6 novembre 2013, par mente

    According to documentation %{}:, should be escaped with slash. But when I escape % the text is not added. There's error message saying Stray % near ')'. But what does it mean and how I can fix it? Command and output:

    $ /usr/bin/ffmpeg -y -i /home/www/255871.mov -af 'aresample=async=1:min_hard_comp=0.100000' -vf 'scale=480:trunc(ow/a/2)*2,transpose=1 [in];movie=watermarks/text-box440.mov,scale=320:55 [bg];[in][bg] overlay=x=20:y=main_h-80,drawtext=fontsize=20:fix_bounds=1:fontfile=Helvetica\\:Style=bold:fontcolor=0xe6b300:text=small kitten \%\):x=30:y=h-80+ascent/2:draw=gte(t\,0)\;lt(t\,5) [out]' -pix_fmt yuv420p -r 24.39 -map_metadata -1 -movflags +faststart -f mp4 -vcodec libx264 -b:v 800k -maxrate 1100k -bufsize 2M -bt 256k -profile:vbaseline -acodec libfdk_aac -ab 64k -ar 44100 -ac 1 /tmp/kitten.mp4
    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
      built on Mar 15 2013 18:40:14 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
      configuration: --enable-gpl --enable-libmp3lame --enable-libvo-aacenc --enable-libx264 --enable-version3 --enable-pthreads --enable-libfaac --enable-nonfree --enable-libfdk_a
    ac --enable-fontconfig --enable-libfreetype
      libavutil      52. 18.100 / 52. 18.100
      libavcodec     54. 92.100 / 54. 92.100
      libavformat    54. 63.104 / 54. 63.104
      libavdevice    54.  3.103 / 54.  3.103
      libavfilter     3. 42.103 /  3. 42.103
      libswscale      2.  2.100 /  2.  2.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  2.100 / 52.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/www/255871.mov':
      Metadata:
        major_brand     : qt
        minor_version   : 0
        compatible_brands: qt
        creation_time   : 2012-07-17 07:42:35
        model           : iPhone 3GS
        model-rus       : iPhone 3GS
        encoder         : 4.2.1
        encoder-rus     : 4.2.1
        date            : 2012-07-17T10:42:35+0300
        date-rus        : 2012-07-17T10:42:35+0300
        make            : Apple
        make-rus        : Apple
      Duration: 00:00:09.38, start: 0.000000, bitrate: 790 kb/s
        Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 720 kb/s, 29.97 fps, 29.97 tbr, 600 tbn, 1200 tbc
        Metadata:
          rotate          : 90
          creation_time   : 2012-07-17 07:42:35
          handler_name    : Core Media Data Handler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s
        Metadata:
          creation_time   : 2012-07-17 07:42:35
          handler_name    : Core Media Data Handler
    [Parsed_drawtext_5 @ 0x2ae9b00] Using "/usr/share/fonts/default/Type1/n019003l.pfb"
    [libx264 @ 0x2ae7d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x2ae7d40] profile Constrained Baseline, level 2.1
    [libx264 @ 0x2ae7d40] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1100 vbv_bufsize=2000 nal_hrd=none ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '/tmp/kitten.mp4':
      Metadata:
        encoder         : Lavf54.63.104
        Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 360x480, q=-1--1, 800 kb/s, 19512 tbn, 24.39 tbc
        Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 64 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> libx264)
      Stream #0:1 -> #0:1 (aac -> libfdk_aac)
    Press [q] to stop, [?] for help
    [Parsed_drawtext_5 @ 0x2ae9b00] Stray % near ')'
        Last message repeated 201 times
    Stray % near ')'0.0 q=27.0 size=     480kB time=00:00:07.96 bitrate= 493.4kbits/s dup=0 drop=35
    [Parsed_drawtext_5 @ 0x2ae9b00] Stray % near ')'
        Last message repeated 77 times
    Starting second pass: moving header on top of the file
    frame=  231 fps=0.0 q=-1.0 Lsize=    1002kB time=00:00:09.47 bitrate= 866.6kbits/s dup=0 drop=50
    video:921kB audio:74kB subtitle:0 global headers:0kB muxing overhead 0.680957%
    [libx264 @ 0x2ae7d40] frame I:1     Avg QP:24.43  size: 13264
    [libx264 @ 0x2ae7d40] frame P:230   Avg QP:23.72  size:  4041
    [libx264 @ 0x2ae7d40] mb I  I16..4: 24.8%  0.0% 75.2%
    [libx264 @ 0x2ae7d40] mb P  I16..4:  2.3%  0.0%  4.8%  P16..4: 34.4% 28.8%  9.4%  0.0%  0.0%    skip:20.3%
    [libx264 @ 0x2ae7d40] coded y,uvDC,uvAC intra: 62.5% 54.2% 4.4% inter: 19.6% 20.3% 0.1%
    [libx264 @ 0x2ae7d40] i16 v,h,dc,p: 36% 29% 19% 16%
    [libx264 @ 0x2ae7d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 21% 20%  6%  8%  7%  7%  6%  6%
    [libx264 @ 0x2ae7d40] i8c dc,h,v,p: 65% 15% 17%  3%
    [libx264 @ 0x2ae7d40] ref P L0: 93.4%  4.3%  2.3%
    [libx264 @ 0x2ae7d40] kb/s:796.32
    
  • ffmpeg libavcodec.so missing while compile with cygwin

    6 novembre 2013, par nick

    I am building ffmpeg for android by following this tutorial

    now i got android folder inside the ffmpeg2.0.1 folder but there is no libavcodec-55.so file. instead of that i have lib/libavcodec.a

    how can i get libavcodec.so file? build_android.sh

    #!/bin/bash
    NDK=$HOME/Desktop/adt/android-ndk-r9
    SYSROOT=$NDK/platforms/android-9/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64
    function build_one
    {
    ./configure \
    --prefix=$PREFIX \
    --enable-shared \
    --disable-static \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-avdevice \
    --disable-doc \
    --disable-symver \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --target-os=linux \
    --arch=arm \
    --enable-cross-compile \
    --sysroot=$SYSROOT \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make
    make install
    }
    CPU=arm
    PREFIX=$(pwd)/android/$CPU 
    ADDI_CFLAGS="-marm"
    build_one
    
  • ffmpeg audio conversion distorted - half rate

    6 novembre 2013, par user1688971

    I'm trying to convert an asf audio to mp3 using ffmpeg. But I have one specific audio that gets distorted in the middle and starts like if the person was talking in slow motion (at half rate).

    The command I'm using is:

    ffmpeg - i input.asf -ac 2 output.mp3

    I've tried a lot of options, but about the middle of the audio is when it fails. The raw file sounds good, so it's not the recording. It is af in the middle of the transmission the frame rate went down for some reason.

    Thanks all!

    [EDIT]

    I'm adding the console response after running the command as a suggestion from LordNeckbeard:

    [root@mynasserver home]# ffmpeg -i recording-8532-1.asf -ac 2 -ab 64k -ar 44100 recording-8532-ac2-ar44100.mp3
    FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
    built on Jan 29 2012 23:56:18 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
    configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
    libavutil     50.15. 1 / 50.15. 1
    libavcodec    52.72. 2 / 52.72. 2
    libavformat   52.64. 2 / 52.64. 2
    libavdevice   52. 2. 0 / 52. 2. 0
    libavfilter    1.19. 0 /  1.19. 0
    libswscale     0.11. 0 /  0.11. 0
    libpostproc   51. 2. 0 / 51. 2. 0
    [flv @ 0x86a4850]max_analyze_duration reached
    [flv @ 0x86a4850]Estimating duration from bitrate, this may be inaccurate
    Input #0, flv, from 'recording-8532-1.asf':
    Metadata:
    source          : STW MediaProxy v3.3.7.19894
    Duration: 04:00:08.49, start: 0.000000, bitrate: N/A
    Stream #0.0: Audio: aac, 44100 Hz, 2 channels (FC), s16
    Output #0, mp3, to 'recording-8532-ac2-ar44100.mp3':
    Metadata:
    TSSE            : Lavf52.64.2
    Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Press [q] to stop encoding
    size=  150906kB time=19315.93 bitrate=  64.0kbits/s    
    video:0kB audio:150906kB global headers:0kB muxing overhead 0.000021%
    

    So from the data above, you can see the input file is about 4hrs. The output ends up being around 5 hrs 20 mins.

  • bash script fail when a command wait ffmpeg to finish

    5 novembre 2013, par d4r10

    In ubuntu 13.04 have a node.js server that launch for certain events, a script like this:

    #! /bin/bash
    ...
    ...
    
    avconv -i "$dir$video" -ss "$ss.000" -t $tt -threads 0 "$folder/$dif.webm"
    
    y_uid=$(/app/youtube-uploader "$folder/$dif.webm" "$label" "$desc" | grep 'watch' | sed 's/v=/ /g' | awk '{print$2}')
    
    echo "$y_uid" >> ~/log/yt.log
    ...
    ...
    

    if avconv (ffmpeg) process a small file (less then 30 minutes of encoding), the script works fine, but if avconv runs for hours, the next command "...youtube-uploader..." (that is a python based application) doesn't work (but if i try to launch it manually, it will go fine).

    I have also tried to launch the next command inside a loop that check if the variable "$y_uid" is empty, so it will try to repeat youtube-uploader until it find a right value, but it will continue to stay in background and will try forever.. (and it is strange, because if i try to launch the command manually, it works fine..).

    Summarizing, seems like that if avconv run for hours, the avconv process will generate a file that is not recognised or locked or a ghost file for the same script (but is recognised if the command is launched outside the script), if it is a small encoding, it will work fine.

    Unfortunatelly It is difficult to debug or test, because i have every time to wait for hours, please help!

    UPDATE

    I think the problem is related at the buffer size of node.js OR some other buffer that store the standard output of ffmpeg. Just correct

    avconv -i "$dir$video" -ss "$ss.000" -t $tt -threads 0 "$folder/$dif.webm"
    

    in

    avconv -i "$dir$video" -ss "$ss.000" -t $tt -threads 0 "$folder/$dif.webm" &> /dev/null
    

    so all the ffmpeg output not full the buffer memory and everythings go well