Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg stop the process after generating thumbnail

    5 octobre 2016, par arjun

    I have installed the ffmpeg in linux server for generating the video thumb nail installed ffmpeg using following commands

     sudo add-apt-repository ppa:mc3man/trusty-media
     sudo apt-get update
     sudo apt-get install ffmpeg
    

    installed in /usr/bin/ffmpeg location

    Here i am calling ffmpeg in my java code

     thumbnail videoThumbTaker = new thumbnail("/usr/bin/ffmpeg");
    
    videoThumbTaker.getThumb(uploadedFileLocation,  thumbnailimagepath,originalLocation, 900, 900, 0, 0, 1); 
    

    Thumbnail is successfully generated,the problem is after generating the thumbnail,ffmpeg process is continuously running,its not stoped.How can achive this!!

  • Looking for Sox (Sound eXchange) libs port for android

    5 octobre 2016, par azure313

    I'm new to mobile development, and i'm developing a mobile application with sound effect functions. I find out that Sox (Sound eXchange) is very strong in desktop environment, and very easy to use, but it didn't have any libs Port for Android.

    Does anyone know how to port SoX to Android or is there any other libs instead?

    I already try ffmpeg, but it didn't have Reverb effect, so i switch to SoX.

    Thank.

  • Convert video file to m2v using FFmpeg

    5 octobre 2016, par utdev

    How can I convert a video file

    video.mpg

    to a

    video.m2v

    plus a

    'video.mp2'

    file?

    Thus the video.m2v file shall have no audio stream, I read that video.m2v files do not have an audio stream, but I am not sure.

    Edit I used Nilz11 command:

    ffmpeg -i input.mpg -codec:v mpeg2video out.m2v
    

    and it created me and .m2v, but my dvdauthroing tool still gives me an error, if I use VLC to convert the .mpg file to an .m2v file the dvdauthoring tool gives me none, does someone know why this is happening?

    Edit: I compared Both files

    and what I found out is that the file which did not work had a bitrate of :

    0

    and the file which did work had a bitrate of:

    8000

    I am not sure but this is the only difference I found between these two files.

    Edit

    Another thing I have to mention is that the .m2v file has to be DVD conform.

  • FFmpeg Android Video cropping speed and perfomance [duplicate]

    5 octobre 2016, par kishore jethava

    This question already has an answer here:

    FFmpeg 15 seconds video takes 15 seconds to crop. How can we reduce this cropping time with command or some other tricks?

    I have refereed this question but didn't helped.

    Here is code

    final FFmpeg ffmpeg = FFmpeg.getInstance(getActivity());
            try {
                ffmpeg.loadBinary(new LoadBinaryResponseHandler() {
    
                    @Override
                    public void onStart() {}
                    @Override
                    public void onFailure() {}
                    @Override
                    public void onSuccess() {
                        Log.i(TAG, "FFMPEG Success ");
                        try {
    
                            /*Logic for cropping the original video to a square video depending of the                                           orientation of the original video*/
    
                            //Command for cropping square video
                            String[] cmd = {"-i", "path/source.mp4", "-vf", "scale=720:ih*720/iw, crop="720:720:0:0, "-preset","ultrafast","-strict","experimental","-vcodec","libx264","-preset","ultrafast","path/destination.mp4"};
                            // Execute cropping of video
                            ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
    
                                @Override
                                public void onStart() {
    
                                }
    
                                @Override
                                public void onProgress(String message) {
                                    Log.i("Square", "progress : " +message);
                                }
    
                                @Override
                                public void onFailure(String message) {
                                    Log.i("Square", "total fail : " + message);
                                }
                                @Override
                                public void onSuccess(String message) {
                                    Log.i("Square", "Cropped video created.");
    
                                }
                                @Override
                                public void onFinish() {
                                }
                            });
                        } catch (FFmpegCommandAlreadyRunningException e) {
                            // Handle if FFmpeg is already running
                        }
                    }
                });
            } catch (FFmpegNotSupportedException e) {
                // Handle if FFmpeg is not supported by device
            }
    

    Logcat

    D/FFmpeg: Running publishing updates method
    I/Square: progress : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
    I/Square: progress :   built with gcc 4.8 (GCC)
    I/Square: progress :   configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    I/Square: progress :   libavutil      55. 17.103 / 55. 17.103
    I/Square: progress :   libavcodec     57. 24.102 / 57. 24.102
    I/Square: progress :   libavformat    57. 25.100 / 57. 25.100
    I/Square: progress :   libavdevice    57.  0.101 / 57.  0.101
    I/Square: progress :   libavfilter     6. 31.100 /  6. 31.100
    I/Square: progress :   libswscale      4.  0.100 /  4.  0.100
    I/Square: progress :   libswresample   2.  0.101 /  2.  0.101
    I/Square: progress :   libpostproc    54.  0.100 / 54.  0.100
    I/Square: progress : Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Content/source.mp4':
    I/Square: progress :   Metadata:
    I/Square: progress :     major_brand     : mp42
    I/Square: progress :     minor_version   : 0
    I/Square: progress :     compatible_brands: isommp42
    I/Square: progress :     creation_time   : 2016-10-05 05:19:12
    I/Square: progress :     com.android.version: 6.0.1
    I/Square: progress :   Duration: 00:00:15.91, start: 0.000000, bitrate: 6174 kb/s
    I/Square: progress :     Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 326 kb/s, 1.59 fps, 30 tbr, 90k tbn, 15 tbc (default)
    I/Square: progress :     Metadata:
    I/Square: progress :       rotate          : 90
    I/Square: progress :       creation_time   : 2016-10-05 05:19:12
    I/Square: progress :       handler_name    : VideoHandle
    I/Square: progress :     Side data:
    I/Square: progress :       displaymatrix: rotation of -90.00 degrees
    I/Square: progress :     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 12 kb/s (default)
    I/Square: progress :     Metadata:
    I/Square: progress :       creation_time   : 2016-10-05 05:19:12
    I/Square: progress :       handler_name    : SoundHandle
    I/Square: progress : [libx264 @ 0xf7544400] using SAR=1/1
    I/Square: progress : [libx264 @ 0xf7544400] using cpu capabilities: none!
    I/Square: progress : [libx264 @ 0xf7544400] profile Constrained Baseline, level 3.1
    I/Square: progress : [libx264 @ 0xf7544400] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 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=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    I/Square: progress : [aac @ 0xf7544c00] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
    I/Square: progress : Output #0, mp4, to '/storage/emulated/0/Content/destination.mp4':
    I/Square: progress :   Metadata:
    I/Square: progress :     major_brand     : mp42
    I/Square: progress :     minor_version   : 0
    I/Square: progress :     compatible_brands: isommp42
    I/Square: progress :     com.android.version: 6.0.1
    I/Square: progress :     encoder         : Lavf57.25.100
    I/Square: progress :     Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 638x638 [SAR 1:1 DAR 1:1], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    I/Square: progress :     Metadata:
    I/Square: progress :       handler_name    : VideoHandle
    I/Square: progress :       creation_time   : 2016-10-05 05:19:12
    I/Square: progress :       encoder         : Lavc57.24.102 libx264
    I/Square: progress :     Side data:
    I/Square: progress :       unknown side data type 10 (24 bytes)
    I/Square: progress :     Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 48 kb/s (default)
    I/Square: progress :     Metadata:
    I/Square: progress :       creation_time   : 2016-10-05 05:19:12
    I/Square: progress :       handler_name    : SoundHandle
    I/Square: progress :       encoder         : Lavc57.24.102 aac
    I/Square: progress : Stream mapping:
    I/Square: progress :   Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
    I/Square: progress :   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    I/Square: progress : Press [q] to stop, [?] for help
    I/Square: progress : frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:05.24 bitrate=   0.1kbits/s speed=10.2x    
    I/Square: progress : frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:10.24 bitrate=   0.1kbits/s speed=  10x    
    I/Square: progress : frame=    0 fps=0.0 q=0.0 size=      19kB time=00:00:14.84 bitrate=  10.5kbits/s speed=9.73x    
    I/Square: progress : frame= 8519 fps=205 q=23.0 size=    3734kB time=00:04:43.53 bitrate= 107.9kbits/s dup=8516 drop=0 speed=6.84x    
    I/Square: progress : frame= 8537 fps=203 q=25.0 size=    3734kB time=00:04:44.13 bitrate= 107.7kbits/s dup=8516 drop=0 speed=6.77x    
    I/Square: progress : frame= 8556 fps=201 q=25.0 size=    3735kB time=00:04:44.76 bitrate= 107.4kbits/s dup=8516 drop=0 speed= 6.7x    
    I/Square: progress : frame= 8575 fps=199 q=25.0 size=    3843kB time=00:04:45.40 bitrate= 110.3kbits/s dup=8516 drop=0 speed=6.64x    
    I/Square: progress : frame= 8594 fps=198 q=25.0 size=    3844kB time=00:04:46.03 bitrate= 110.1kbits/s dup=8516 drop=0 speed=6.58x    
    I/Square: progress : frame= 8614 fps=196 q=25.0 size=    3844kB time=00:04:46.70 bitrate= 109.8kbits/s dup=8516 drop=0 speed=6.52x    
    I/Square: progress : frame= 8633 fps=194 q=25.0 size=    3844kB time=00:04:47.33 bitrate= 109.6kbits/s dup=8516 drop=0 speed=6.45x    
    I/Square: progress : frame= 8652 fps=192 q=25.0 size=    3844kB time=00:04:47.96 bitrate= 109.4kbits/s dup=8516 drop=0 speed= 6.4x    
    I/Square: progress : frame= 8672 fps=190 q=26.0 size=    3844kB time=00:04:48.63 bitrate= 109.1kbits/s dup=8516 drop=0 speed=6.34x    
    I/Square: progress : frame= 8691 fps=189 q=25.0 size=    3845kB time=00:04:49.26 bitrate= 108.9kbits/s dup=8516 drop=0 speed=6.28x    
    I/Square: progress : frame= 8711 fps=187 q=26.0 size=    3845kB time=00:04:49.93 bitrate= 108.6kbits/s dup=8516 drop=0 speed=6.23x    
    I/Square: progress : frame= 8731 fps=185 q=26.0 size=    3845kB time=00:04:50.60 bitrate= 108.4kbits/s dup=8516 drop=0 speed=6.17x    
    I/Square: progress : frame= 8750 fps=184 q=26.0 size=    3845kB time=00:04:51.23 bitrate= 108.2kbits/s dup=8516 drop=0 speed=6.12x    
    I/Square: progress : frame= 8770 fps=182 q=26.0 size=    3846kB time=00:04:51.90 bitrate= 107.9kbits/s dup=8516 drop=0 speed=6.07x    
    I/Square: progress : frame= 8791 fps=181 q=26.0 size=    3846kB time=00:04:52.60 bitrate= 107.7kbits/s dup=8516 drop=0 speed=6.02x    
    I/Square: progress : frame= 8811 fps=179 q=26.0 size=    3846kB time=00:04:53.26 bitrate= 107.4kbits/s dup=8516 drop=0 speed=5.97x    
    I/Square: progress : frame= 8831 fps=178 q=26.0 size=    3971kB time=00:04:53.93 bitrate= 110.7kbits/s dup=8516 drop=0 speed=5.92x    
    I/Square: progress : frame= 8851 fps=177 q=26.0 size=    4214kB time=00:04:54.60 bitrate= 117.2kbits/s dup=8516 drop=0 speed=5.88x    
    I/Square: progress : frame= 8871 fps=175 q=25.0 size=    4451kB time=00:04:55.26 bitrate= 123.5kbits/s dup=8516 drop=0 speed=5.83x    
    I/Square: progress : frame= 8891 fps=174 q=26.0 size=    4705kB time=00:04:55.93 bitrate= 130.2kbits/s dup=8516 drop=0 speed=5.78x    
    I/Square: progress : frame= 8911 fps=172 q=26.0 size=    4963kB time=00:04:56.60 bitrate= 137.1kbits/s dup=8516 drop=0 speed=5.74x    
    I/Square: progress : frame= 8932 fps=171 q=26.0 size=    5226kB time=00:04:57.30 bitrate= 144.0kbits/s dup=8516 drop=0 speed= 5.7x    
    I/Square: progress : frame= 8952 fps=170 q=26.0 size=    5475kB time=00:04:57.96 bitrate= 150.5kbits/s dup=8516 drop=0 speed=5.65x    
    I/Square: progress : frame= 8972 fps=169 q=26.0 size=    5730kB time=00:04:58.63 bitrate= 157.2kbits/s dup=8516 drop=0 speed=5.61x    
    I/Square: progress : frame= 8992 fps=167 q=26.0 size=    5970kB time=00:04:59.30 bitrate= 163.4kbits/s dup=8516 drop=0 speed=5.57x    
    I/Square: progress : frame= 8993 fps=167 q=-1.0 Lsize=    9456kB time=00:04:59.76 bitrate= 258.4kbits/s dup=8516 drop=0 speed=5.56x    
    I/Square: progress : video:9350kB audio:68kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.404826%
    I/Square: progress : [libx264 @ 0xf7544400] frame I:36    Avg QP:10.64  size:107101
    I/Square: progress : [libx264 @ 0xf7544400] frame P:8957  Avg QP:13.80  size:   638
    I/Square: progress : [libx264 @ 0xf7544400] mb I  I16..4: 100.0%  0.0%  0.0%
    I/Square: progress : [libx264 @ 0xf7544400] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4:  4.3%  0.0%  0.0%  0.0%  0.0%    skip:95.3%
    I/Square: progress : [libx264 @ 0xf7544400] coded y,uvDC,uvAC intra: 78.5% 24.5% 12.4% inter: 2.6% 0.2% 0.0%
    I/Square: progress : [libx264 @ 0xf7544400] i16 v,h,dc,p: 28% 12% 42% 18%
    I/Square: progress : [libx264 @ 0xf7544400] i8c dc,h,v,p: 59% 15% 22%  4%
    I/Square: progress : [libx264 @ 0xf7544400] kb/s:255.50
    I/Square: progress : [aac @ 0xf7544c00] Qavg: 65536.000
    I/Square: Cropped video created.
    I/Square: finished
    
  • How to stretch the WAV file to the same video length ?

    5 octobre 2016, par Michael Heuberger

    So yeah, having a tricky ffmpeg issue here.

    In my app I'm encoding a video based on image frames and add a WAV file for the sound from the same source but through a different web socket. It can happen that the WAV file doesn't always have exactly the same length as the video based on those images + fps (plus minus few seconds).

    How can I tell ffmpeg to "stretch" the input WAV file to have it the same length as the video?

    In short: images (i) + WAV (w) = final video (v)

    length(w) != length (v) ... which is causing problems.

    Here an example ffmpeg command I am currently using:

    ffmpeg -f image2 -thread_queue_size 512 -framerate 21.5 -i /frames/%d.webp -i videomail_preview.wav -y -acodec aac -strict experimental -ac 1 -vcodec libx264 -crf 16 -preset fast -profile:v baseline -pix_fmt yuv420p -loglevel warning -movflags +faststart videomail_good.mp4 -acodec libvorbis -ac 1 -vcodec libvpx -crf 8 -deadline good -cpu-used 1 -pix_fmt yuv420p -loglevel warning -movflags +faststart videomail_good.webm

    Any suggestions/trick I am unaware of?