Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Do ffmpeg and ffprobe share the same code for metadata extraction ?

    3 décembre 2013, par user931392

    I want to make a simple transcoding service and I want to use ffprobe (because of the -print_format option) to get the metdata of a file (duration, width x height (if required), bit rate, etc) and ffmpeg for the transcoding itself.

    My question is: Is it safe to use the metadata from the ffprobe output to generate a command line for ffmpeg?

  • Has anyone gotten a windows build of FFMPEG to publish to Akamai's CDN via RTMP ?

    3 décembre 2013, par Ken Conner

    I am trying to live stream a file to Akamai's servers via RTMP from flash and I cannot get past the authentication step even though I know I am using the right username and password (the credentials work in FMLE). I Have found some posts online but they are older and its difficult because no one ever reports what build of FFMPEG they are using.

    Has anyone gotten this to work with Windows binaries?

  • Installation Error when installing MLT [on hold]

    3 décembre 2013, par user3060419

    my PC configuration is Gnome version 3.4.2 memory 1.7Gib Processor AMD Athlon(tm) II X2 270 Processor × 2 Graphics VESA: RS780 Base system Debian GNU/Linux 7 (wheezy) 64-bit Disc 486.3Gib

    I tried to intall MLT(Media Lovin Toolkit). after installing all dependencies when i configure with this command----

    ./configure --prefix=/usr --enable-gpl --qimage-libdir=/usr/lib/ --qimage-includedir=/usr/include/qt4

    Then the output shows as----

    Configuring modules/linsys:

    Configuring modules/lumas:

    Configuring modules/motion_est:

    Configuring modules/normalize:

    Configuring modules/oldfilm:

    Configuring modules/opengl:

    Configuring modules/plus:

    Configuring modules/qimage:

    • Qt not found: disabling

    Configuring modules/resample:

    Configuring modules/rotoscoping:

    Configuring modules/rtaudio:

    Configuring modules/sdl:

    Configuring modules/sox:

    Configuring modules/swfdec:

    Configuring modules/videostab:

    Configuring modules/vmfx:

    Configuring modules/vorbis:

    Configuring modules/xine:

    Configuring modules/xml:

    Configuring mlt++:

    Configuring swig:

    GPLv2 license used; GPLv3 components disabled

    and when i try to make by make command, then the output is---->

    list='src/framework src/mlt++ src/melt src/modules src/swig profiles'; \ for subdir in $list; do \ make -s -C $subdir depend || exit 1; \ make -C $subdir all || exit 1; \ done make[1]: Entering directory `/root/mlt/src/framework'

    make[1]: Nothing to be done for `all'.

    make[1]: Leaving directory `/root/mlt/src/framework'

    make[1]: Entering directory `/root/mlt/src/mlt++'

    make[1]: Nothing to be done for `all'.

    make[1]: Leaving directory `/root/mlt/src/mlt++'

    make[1]: Entering directory `/root/mlt/src/melt'

    make[1]: Nothing to be done for `all'.

    make[1]: Leaving directory `/root/mlt/src/melt'

    make[1]: Entering directory `/root/mlt/src/modules'

    list='xml kino rotoscoping motion_est avformat effectv vmfx gtk2 opengl videostab rtaudio jackrack resample oldfilm decklink sox vorbis dv core linsys feeds kdenlive frei0r qimage swfdec plus xine lumas avsync normalize dgraft sdl'; \ for subdir in $list; do \

        if [ -f $subdir/Makefile -a ! -f disable-$subdir ] ; \
    
        then make -C $subdir all || exit 1; \
    
        fi \
    
    done
    

    make[2]: Entering directory `/root/mlt/src/modules/xml'

    make[2]: Nothing to be done for `all'.

    make[2]: Leaving directory `/root/mlt/src/modules/xml'

    make[2]: Entering directory `/root/mlt/src/modules/kino'

    g++ -I../../ -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags libquicktime pkg-config --cflags libdv -Wno-deprecated pkg-config --cflags libquicktime -c -o kino_wrapper.o kino_wrapper.cc

    g++ -I../../ -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags libquicktime pkg-config --cflags libdv

    -Wno-deprecated pkg-config --cflags libquicktime -c -o avi.o avi.cc

    g++ -I../../ -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags libquicktime pkg-config --cflags libdv -Wno-deprecated pkg-config --cflags libquicktime -c -o filehandler.o filehandler.cc

    g++ -I../../ -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags libquicktime pkg-config --cflags libdv -Wno-deprecated pkg-config --cflags libquicktime -c -o riff.o riff.cc

    g++ -shared -o ../libmltkino.so factory.o producer_kino.o kino_wrapper.o avi.o error.o

    filehandler.o riff.o -L../../framework -lmlt -lpthread -Wl,--no-undefined -Wl,--as-needed -lstdc++ pkg-config --libs libquicktime pkg-config --libs libdv

    make[2]: Leaving directory `/root/mlt/src/modules/kino'

    make[2]: Entering directory `/root/mlt/src/modules/rotoscoping'

    make[2]: Nothing to be done for `all'.

    make[2]: Leaving directory `/root/mlt/src/modules/rotoscoping'

    make[2]: Entering directory `/root/mlt/src/modules/motion_est'

    make[2]: Nothing to be done for `all'.

    make[2]: Leaving directory `/root/mlt/src/modules/motion_est'

    make[2]: Entering directory `/root/mlt/src/modules/avformat'

    cc -shared -o ../libmltavformat.so factory.o filter_avcolour_space.o filter_avresample.o filter_avdeinterlace.o filter_swscale.o producer_avformat.o consumer_avformat.o -L../.. /framework -lmlt -lpthread -Wl,--no-undefined -Wl,--as-needed -lavformat -lavcodec -lavutil -lswscale -lavdevice

    make[2]: Leaving directory `/root/mlt/src/modules/avformat'

    make[2]: Entering directory `/root/mlt/src/modules/effectv'

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o factory.o factory.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o filter_burn.o filter_burn.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre

    -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE

    -fPIC -pthread -c -o image.o image.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o utils.o utils.c

    cc -shared -o ../libmlteffectv.so factory.o filter_burn.o image.o utils.o -L../../framework -lmlt -lm -Wl,--no-undefined -Wl,--as-needed

    make[2]: Leaving directory `/root/mlt/src/modules/effectv'

    make[2]: Entering directory `/root/mlt/src/modules/vmfx'

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o factory.o factory.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o filter_chroma.o filter_chroma.c

    filter_chroma.c: In function ‘filter_get_image’:

    filter_chroma.c:52:10: warning: variable ‘y’ set but not used [-Wunused-but-set-variable]

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o filter_chroma_hold.o filter_chroma_hold.c

    filter_chroma_hold.c: In function ‘filter_get_image’:

    filter_chroma_hold.c:52:10: warning: variable ‘y’ set but not used [-Wunused-but-set- variable]

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o filter_mono.o filter_mono.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o filter_shape.o filter_shape.c

    filter_shape.c: In function ‘filter_process’:

    filter_shape.c:137:9: warning: variable ‘extension’ set but not used [-Wunused-but-set- variable] cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread -c -o producer_pgm.o producer_pgm.c

    cc -shared -o ../libmltvmfx.so factory.o filter_chroma.o filter_chroma_hold.o filter_mono.o filter_shape.o producer_pgm.o -L../../framework -lmlt -Wl,--no-undefined -Wl,--as-needed

    make[2]: Leaving directory `/root/mlt/src/modules/vmfx'

    make[2]: Entering directory `/root/mlt/src/modules/gtk2'

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0 pkg-config --cflags pangoft2 -c -o factory.o factory.c factory.c: In function ‘initialise’: factory.c:47:3: warning: ‘g_type_init’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations]

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0 pkg-config --cflags pangoft2 -c -o consumer_gtk2.o consumer_gtk2.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0 pkg-config --cflags pangoft2 -c -o producer_pixbuf.o producer_pixbuf.c cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0 pkg-config --cflags pangoft2 -c -o pixops.o pixops.c pixops.c: In function ‘pixops_process’: pixops.c:410:20: warning: variable ‘tcolor2’ set but not used [-Wunused-but-set-variable]

    pixops.c:410:11: warning: variable ‘tcolor1’ set but not used [-Wunused-but-set-variable]

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE

    -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0

    pkg-config --cflags pangoft2 -c -o filter_rescale.o filter_rescale.c

    cc -I../.. -DARCH_X86_64 -Wall -DPIC -O2 -pipe -fno-tree-dominator-opts -fno-tree-pre -ffast-math -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -pthread pkg-config --cflags gtk+-2.0 pkg-config --cflags gdk-pixbuf-2.0 pkg-config --cflags pangoft2 -c -o producer_pango.o producer_pango.c

    producer_pango.c:28:31: fatal error: freetype/freetype.h: No such file or directory compilation terminated.

    make[2]: * [producer_pango.o] Error 1

    make[2]: Leaving directory `/root/mlt/src/modules/gtk2'

    make[1]: * [all] Error 1

    make[1]: Leaving directory `/root/mlt/src/modules'

    make: * [all] Error 1

    Anyone please help me to install MLT, I really need help seriously.

  • ffmpeg command convert a part of video file to an audio file [migrated]

    3 décembre 2013, par Amarnath alias Roobal

    I have a video file (duration 1 hour). I need any part of video file(30 min) to be converted to audio file

    ffmpeg -ss 00:30:00 -t 01:00:00 -i /opt/a.mp4 -vcodec copy -acodec copy /opt/b.mp4
    

    then i used

    ffmpeg -ss 00:30:00 -t 01:00:00 -i /opt/a.mp4 -acodec copy /opt/b.mp4
    

    But still I can view the video along with the audio. I need only audio files

  • Concurrently redirect Process stdin and stdout in Process Class

    3 décembre 2013, par Andrew Simpson

    I have a desktop application written in C#.

    I am using ffmpeg using the Process class.

    Currently there are 2 stages in my code.

    The first is that I supply byte arrays (each array is a jpeg) to the stdin to create an ogg file.

    This is the code for that:

       public byte[] EncodeAndUploadImages(string _args1, string _fn)  
        {
            byte[] _data = null;
            try
            {
                clientBuild = new Process();
                clientBuild.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
                clientBuild.StartInfo.Arguments = " -f mjpeg -r 30 -i - -c:v libtheora -q:v 7 -r 30 -f ogg -";
                clientBuild.StartInfo.FileName = Environment.CurrentDirectory + @"\ffmpeg.exe";
                clientBuild.StartInfo.UseShellExecute = false;
                clientBuild.StartInfo.RedirectStandardOutput = true;
                clientBuild.StartInfo.RedirectStandardError = true;
                clientBuild.StartInfo.RedirectStandardInput = true;
                clientBuild.StartInfo.CreateNoWindow = true;
                clientBuild.StartInfo.LoadUserProfile = false;
                clientBuild.EnableRaisingEvents = true;    
                clientBuild.Start();
    
                using (BinaryWriter bw = new BinaryWriter(clientBuild.StandardInput.BaseStream))
                {
                    for (int i = 1; i < 20; i++)
                    {
                        using (MemoryStream ms = new MemoryStream())
                        {
                            System.Diagnostics.Debug.Write(i.ToString("00000"));
                            Bitmap bmp = new Bitmap("h:\\streamin\\" + i.ToString("00000") + ".jpg");
                            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                            bw.Write(ms.ToArray());                           
                            bmp.Dispose();
                            ms.Close();
                        }
                    }
                    bw.Close();
                }
    
                mStandardOutput = clientBuild.StandardOutput.BaseStream;
                mStandardOutput.BeginRead(mReadBuffer, 0, mReadBuffer.Length, StandardOutputReadCallback, null);
                clientBuild.WaitForExit();
                _data = mStandardOutputMs.ToArray();
                mStandardOutput.Close();
            }
            catch (Exception _ex)
            {
    
            }
            finally
            {
                clientBuild.Dispose();
            }
            return _data;
        }
    

    The stdout gives me that ogg file in a new byte array.

    The second part of my code takes a ogg file on my hard disk and extracts all the jpegs contained init to stdout in byte array format.

    Here is that code:

       private void ExtractImagesFromVideo(byte[] data,string _args)
        {
            try
            {
                build = new Process();
                build = new Process();
                build.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
                build.StartInfo.Arguments =  "-i \"h:\\streamout\\cache.ogg\" -vf scale=640:-1 -an -vframes 100 -r 1 -f image2pipe -";
                build.StartInfo.FileName = @"C:\inetpub\wwwroot\bin\ffmpeg.exe";
                build.StartInfo.UseShellExecute = false;
                build.StartInfo.RedirectStandardOutput = true;
                build.StartInfo.RedirectStandardError = true;
                build.StartInfo.RedirectStandardInput = true;
                build.StartInfo.CreateNoWindow = true;
                build.StartInfo.LoadUserProfile = false;
                build.EnableRaisingEvents = true;    
                build.Start();
    
    
                mStandardOutput = build.StandardOutput.BaseStream;
                mStandardOutput.BeginRead(mReadBuffer, 0, mReadBuffer.Length, StandardOutputReadCallback, null);
                build.WaitForExit();
                byte[] _data5 = mStandardOutputMs.ToArray();
                mStandardOutput.Close();
            }
            catch (Exception _ex)
            {
    
            }
            finally
            {
                build.Dispose();
            }
        }
    

    Now I would like to fuse the 2 processes. The ultimate aim is to supply stdin from a ogg file in byte array format and to extract the contaomed jpegs in byte array format.

    But if i do this:

       private void ExtractImagesFromVideo(byte[] data,string _args)
        {
            try
            {
                build = new Process();
                build = new Process();
                build.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
                build.StartInfo.Arguments = "-i pipe:0 -vf scale=640:-1 -an -vframes 100 -r 1 -f image2pipe -";
                build.StartInfo.FileName = @"C:\inetpub\wwwroot\bin\ffmpeg.exe";
                build.StartInfo.UseShellExecute = false;
                build.StartInfo.RedirectStandardOutput = true;
                build.StartInfo.RedirectStandardError = true;
                build.StartInfo.RedirectStandardInput = true;
                build.StartInfo.CreateNoWindow = true;
                build.StartInfo.LoadUserProfile = false;
                build.EnableRaisingEvents = true;    
                build.Start();
    
    
                using (BinaryWriter bw = new BinaryWriter(build.StandardInput.BaseStream))
                {
                    bw.Write(data);  //code hangs here!!!!
                }
    
                mStandardOutput = build.StandardOutput.BaseStream;
                mStandardOutput.BeginRead(mReadBuffer, 0, mReadBuffer.Length, StandardOutputReadCallback, null);
                build.WaitForExit();
                byte[] _data5 = mStandardOutputMs.ToArray();
                mStandardOutput.Close();
            }
            catch (Exception _ex)
            {
    
            }
            finally
            {
                build.Dispose();
            }
        }
    

    The code hangs where I indicated.

    Can anyone advise please?

    Thanks