Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Put audio and video tracks all together

    24 février 2014, par Albert

    I have one video track (xvid) and two audio tracks (ac3) in three different files, and I want to put them together. I succeeded, but there is a problem. This is the command I use:

    ffmpeg -i video.avi -i audio_es.ac3 -i audio_en.ac3 -map 0:0 -map 1:0 -map 2:0 -vcodec copy -acodec copy -acodec copy  video2.avi -newaudio
    

    And this is the output

    Fmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
          configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
          libavutil     49.15. 0 / 49.15. 0
          libavcodec    52.20. 1 / 52.20. 1
          libavformat   52.31. 0 / 52.31. 0
          libavdevice   52. 1. 0 / 52. 1. 0
          libavfilter    0. 4. 0 /  0. 4. 0
          libswscale     0. 7. 1 /  0. 7. 1
          libpostproc   51. 2. 0 / 51. 2. 0
          built on Jan 24 2013 19:42:59, gcc: 4.4.3
        [avi @ 0x22be260]non-interleaved AVI
        Input #0, avi, from 'video.avi':
          Duration: 00:50:01.00, start: 0.000000, bitrate: 2988 kb/s
            Stream #0.0: Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
        Input #1, ac3, from 'audio_es.ac3':
          Duration: 00:50:00.99, bitrate: 320 kb/s
            Stream #1.0: Audio: ac3, 48000 Hz, stereo, s16, 320 kb/s
        Input #2, ac3, from 'audio_en.ac3':
          Duration: 00:50:00.99, bitrate: 320 kb/s
            Stream #2.0: Audio: ac3, 48000 Hz, stereo, s16, 320 kb/s
        Output #0, avi, to 'video3.avi':
            Stream #0.0: Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 90k tbn, 25 tbc
            Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 320 kb/s
            Stream #0.2: Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s
        Stream mapping:
          Stream #0.0 -> #0.0
          Stream #1.0 -> #0.1
          Stream #2.0 -> #0.2
        Press [q] to stop encoding
        frame= 9796 fps=5319 q=-1.0 Lsize=  129383kB time=391.84 bitrate=2704.9kbits/s   
        video:110097kB audio:18368kB global headers:0kB muxing overhead 0.714597%
    

    As you see in output stream, it doesn't convert any input file except second audio stream into mp2 (64kbps), while input file is AC3 (320kbps). I don't know how to tell ffmpeg to not convert any file. Just put them together as they are.

    Can anybody help me?

  • stream vlc playlist trhough ffmpeg to rtmp live streaming [on hold]

    24 février 2014, par TamilArivu

    i am just tried to stream my playlist mp4 file to my live stream. i am using play my playlist via vlc and also stream via vlc. i am using the following code

    vlc --playlist-autostart --loop  --playlist-tree http://xxxxx.com/test --sout '#transcode{vcodec=h264,vb=300,fps=25,scale=1,acodec=mp4a,ab=64,channels=2}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://xxxxx.com/xxx/xxx1}'
    

    the above code play the playlist file but the streaming is not work . when i am run this code in my ubuntu command prompt it's return the following error

    VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b)
    [0x678d58] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    [0x678d58] main interface error: no suitable interface module
    [0x678d58] main interface error: no suitable interface module
    [0x648108] main libvlc error: interface "globalhotkeys,none" initialization failed
    [0x648108] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
    [0x678d58] qt4 interface error: Could not connect to X server
    [0x678d58] skins2 interface error: cannot initialize OSFactory
    [0x678d58] [cli] lua interface: Listening on host "*console".
    VLC media player 2.0.8 Twoflower
    Command Line Interface initialized. Type `help' for help.
    > Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
    Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
    Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
    Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
    x264 [info]: profile High, level 3.1
    x264 [info]: final ratefactor: 35.88
    x264 [info]: using SAR=109/160
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
    x264 [info]: profile High, level 3.1
    [flv @ 0x7f6d09133500] Codec for stream 0 does not use global headers but container format requires global headers
    [flv @ 0x7f6d09133500] Codec for stream 1 does not use global headers but container format requires global headers
    [flv @ 0x7f6d09133500] Packets are not in the proper order with respect to DTS
    [0x7f6d08003808] avformat mux error: could not write frame (pts: 240002, dts: 40001) (pkt pts: 240, dts: 40) 
    

    how can i solve this problem

  • Use ffmpeg with python

    24 février 2014, par user2063350

    I have an ffmpeg setup on my pc, which streams mp3 with this code:

    ffmpeg -f dshow -i audio="Input device" -c:a libmp3lame -f mpegts udp://192.168.1.2:7777
    

    Also i have a server and I want to start recording stream to mp3 file whenever stream starts. Server is running all day long listening for pc to connect. How can I do this with python? I want to create unique file with time and date in filename in filename each time stream starts. Can I do this using udp protocol or what protocol do You suggest me to use? and what modules in python are helpful for this task?

    subprocess.call('ffmpeg -y -i udp://192.168.1.2:7777 -acodec copy output.mp3')
    

    P.S. Sorry for my bad English.

  • FFMPEG build for android on ubuntu

    23 février 2014, par james

    I am developing a media app which provides support for all video formats for implementing this feature we require FFMPEG the very best library for codecs. Compiling FFMPEG on windows for android is very long battle so I migrated to ubuntu I have almost compiled it shows the the binaries but it gives at last point following message

    >AR libpostproc/libpostproc.a
    AR  libswresample/libswresample.a
    AR  libswscale/libswscale.a
    AR  libavcodec/libavcodec.a
    AR  libavutil/libavutil.a
    INSTALL libavfilter/libavfilter.a
    INSTALL libavformat/libavformat.a
    INSTALL libavresample/libavresample.a
    INSTALL libpostproc/libpostproc.a
    INSTALL libswresample/libswresample.a
    INSTALL libswscale/libswscale.a
    INSTALL libavutil/libavutil.a
    LD  ffmpeg_g
    INSTALL libavcodec/libavcodec.a
    CP  ffmpeg
    STRIP   ffmpeg
    skipping strip ffmpeg
    INSTALL install-progs-yes
    INSTALL ffmpeg
    /home/akshay/Desktop/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-ld: -: unknown option
    

    Here is my script

    #!/bin/bash
    NDK=/home/akshay/Desktop/android-ndk-r9c
    PLATFORM=$NDK/platforms/android-8/arch-arm
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86
    PREFIX=./android-ffmpeg
    function build_one
    {
        ./configure --target-os=linux --prefix=$PREFIX \
        --enable-cross-compile \
        --enable-runtime-cpudetect \
        --disable-asm \
        --arch=arm \
        #--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
        --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
        --disable-stripping \
        #--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
        --sysroot=$PLATFORM \
        --enable-nonfree \
        --enable-version3 \
        --disable-everything \
        --enable-gpl \
        --disable-doc \
        --enable-avresample \
        --enable-demuxer=rtsp \
        --enable-muxer=rtsp \
        --disable-ffplay \
        --disable-ffserver \
        --enable-ffmpeg \
        --disable-ffprobe \
        --enable-encoders \
        --enable-decoders \
        --enable-protocols \
        --enable-hwaccels \
        --enable-zlib \
        --disable-devices \
        --disable-avdevice \
        --extra-cflags="-I/home/android-ffmpeg/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \
        --extra-ldflags="-L/home/android-ffmpeg/lib"
        make -j4 install
        $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
        $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib  -soname libffmpeg.so -shared -  nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/     libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -  llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.8/libgcc.a
    }
    build_one
    

    Please tell me anything wrong in the script

  • ffmpeg and python usage

    23 février 2014, par user2063350

    I have an ffmpeg setup on my pc, which streams mp3 with this code:

    ffmpeg -f dshow -i audio="Input device" -c:a libmp3lame -f mpegts udp://192.168.1.2:7777
    

    Also i have a server and I want my python script to run 24/7 on server and start/stop writing stream to mp3 file every time pc get's turned on/off. I need new file every time pc turns on (use time and date for filename for example) to bypass overwriting. Using python's subprocess module and ffmpeg I can save file on my server like this:

    subprocess.call('ffmpeg -y -i udp://192.168.1.2:7777 -acodec copy output.mp3')
    

    But I need condition, when to start recording(listen if 7777 port is reciving data or something like that), is it even possible to implement such thing, using python? P.S. Sorry for my bad English.