Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Force avconv to exit when error occurs

    24 février 2014, par Grzes

    I want to generate a thumbnail of video. Sometimes for a huge video. Now I'm doing it by partially downloading video file (the first X MB and the last kilobytes to handle videos when metadata is at the end of file, the rest of file is a huge hole).

    I'm using avconv to make a thumbnail for 13 second.

    avconv -i video.mp4 -f image2 -vframes 1 -ss 00:00:13 thumbnail.png
    

    When there was downloaded not enough data, the thumbnail is often broken. avconv prints the following error messages, nevertheless it returns code 0 and outputs thumbnail file.

    [h264 @ 0x11420c0] AVC: nal size 0
    [h264 @ 0x11420c0] no frame!
    [h264 @ 0x142a820] AVC: nal size 0
    
    [h264 @ 0x1141aa0] no frame!
    Error while decoding stream #0:0
    [h264 @ 0x11420c0] AVC: nal size 0
    

    How to force avconv to finish and return code other than 0 when such case occurs or generally when error occurs?

    Thanks in advance!

    Grzegorz

  • How to create .mp4 file with custom frame rate

    24 février 2014, par theGeekster

    I have 10 files in a folder /nums/0-10.jpg. Want to create a three .mp4 files with different output FPS.

    1. nums1.mp4 = should play 1 frame in every second
    2. nums2.mp4 = should play 2 frame in a second
    3. nums5.mp4 = should play 5 frame in a second

    This code generates an mp4 with default settings

    >ffmpeg -i /nums/%00d.jpg nums.mp4
    
  • 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.