Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Unrecognized options even though compiled FFmpeg on Ubuntu manually

    11 février 2016, par Kathy Lee

    I would like to convert a video from .avi to .mp4 with same quality using ffmpeg but the command I put in the terminal always report some errors saying that there are unrecognized options.

    I have compiled the ffmpeg manually following the steps in http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

    After compiling the ffmpeg, I used the command below the compress the video

    ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a libfaac -b:a 192k -ac 2 output.mp4
    

    But the error message is saying "Unrecognized option 'crf'":

    ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
    configuration: --enable-nonfree --enable-pic --enable-shared
    libavutil      54. 31.100 / 54. 31.100
    libavcodec     56. 60.100 / 56. 60.100
    libavformat    56. 40.101 / 56. 40.101
    libavdevice    56.  4.100 / 56.  4.100
    libavfilter     5. 40.101 /  5. 40.101
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  2.101 /  1.  2.101
    Unrecognized option 'crf'.
    Error splitting the argument list: Option not found
    

    Then I tried to omit flag -crf, but I got error saying

    Unrecognized option 'preset'.
    Error splitting the argument list: Option not found
    

    Then I omitted flag -preset, it says I do not have libx264....

    [mjpeg @ 0x164f2c0] Changeing bps to 8
    Input #0, avi, from 'backup_bush.avi':
      Duration: 00:01:40.70, start: 0.000000, bitrate: 12409 kb/s
        Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 400x250 [SAR 1:1 DAR 8:5], 12407 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Unknown encoder 'libx264'
    

    I am very confused what is going on because I have complied ffmpeg step by step and also installed the dependencies such as libx264 as described in http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu. The command I used to configure ffmpeg is

     ./configure   --prefix="$HOME/ffmpeg_build"   --pkg-config-flags="--static"   --extra-cflags="-I$HOME/ffmpeg_build/include"   --extra-ldflags="-L$HOME/ffmpeg_build/lib"   --bindir="$HOME/bin"   --enable-gpl   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libtheora   --enable-libvorbis   --enable-libvpx   --enable-libx264   --enable-nonfree
    

    Why these errors happen? How can I fix them to allow me to convert the video from .avi to .mp4?

    Thank you very much!

  • Python matplotlib.animation [Errno 13] Permission denied

    11 février 2016, par Fishman

    I am trying to create a simple animated histogram and save it as a .mp4 using matplotlib and ffmpeg on a mac. I have already installed ffMpeg, specified the ffmpeg path, and now I am getting a permission denied error when writing to a folder in my desktop. I tried running as sudo and still get the same error. Help is much appreciated, thank you!

    Here is the code:

    df = pd.read_csv('.../data.csv')
    
    df = df.dropna()
    #Get list of weeks
    weeks = df.ot_date.unique()
    fig, ax = plt.subplots()
    
    data = df.intervals_filled[df['ot_date'].isin([weeks[0]])]
    n, bins = np.histogram( data , 20)
    
    # get the corners of the rectangles for the histogram
    left = np.array(bins[:-1])
    right = np.array(bins[1:])
    bottom = np.zeros(len(left))
    top = bottom + n
    nrects = len(left)
    
    # here comes the tricky part -- we have to set up the vertex and path
    # codes arrays using moveto, lineto and closepoly
    
    # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
    # CLOSEPOLY; the vert for the closepoly is ignored but we still need
    # it to keep the codes aligned with the vertices
    nverts = nrects*(1 + 3 + 1)
    verts = np.zeros((nverts, 2))
    codes = np.ones(nverts, int) * path.Path.LINETO
    codes[0::5] = path.Path.MOVETO
    codes[4::5] = path.Path.CLOSEPOLY
    verts[0::5, 0] = left
    verts[0::5, 1] = bottom
    verts[1::5, 0] = left
    verts[1::5, 1] = top
    verts[2::5, 0] = right
    verts[2::5, 1] = top
    verts[3::5, 0] = right
    verts[3::5, 1] = bottom
    
    barpath = path.Path(verts, codes)
    patch = patches.PathPatch(
        barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
    ax.add_patch(patch)
    
    ax.set_xlim(left[0], right[-1])
    ax.set_ylim(bottom.min(), top.max()+40)
    ax.set_xlabel('Number of intervals/week')
    ax.set_ylabel('Count of CSAs')
    plt.rcParams['animation.ffmpeg_path'] = '/usr/local/Cellar/ffmpeg'
    FFwriter = animation.FFMpegWriter()
    
    def animate(i):
        print i
        # simulate new data coming in
        data = df.intervals_filled[df['ot_date'].isin([weeks[i-1]])]
        n, bins = np.histogram(data, 20)
        yearweek = str(weeks[i-1])
        year = yearweek[0:4]
        week = yearweek[4:]
        title = 'Week %(wk)s of %(yr)s' %{'wk': week, 'yr': year}
        ax.set_title(title)
        top = bottom + n
        verts[1::5, 1] = top
        verts[2::5, 1] = top
        return [patch, ]
    
    ani = animation.FuncAnimation(fig, animate, 53,interval=1000, repeat=False)
    ani.save('/Users/.../Desktop/1b.mp4', writer = FFwriter)
    plt.show()
    

    And here is the traceback:

    Traceback (most recent call last):
      File "/Users/Fishman1049/Desktop/reserves_histogram_timeline/python/1b_text.py", line 109, in 
        ani.save('/Users/Fishman1049/Desktop/1b', writer = FFwriter)
      File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 761, in save
        with writer.saving(self._fig, filename, dpi):
      File "/Users/Fishman1049/anaconda/lib/python2.7/contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 186, in saving
        self.setup(*args)
      File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 176, in setup
        self._run()
      File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 204, in _run
        creationflags=subprocess_creation_flags)
      File "/Users/Fishman1049/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
        errread, errwrite)
      File "/Users/Fishman1049/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
        raise child_exception
    OSError: [Errno 13] Permission denied
    

    I am running matplotlib version 1.5.1, just installed FFmpeg today using homebrew, spyder 2.3.8, python 2.7 and OS X 10.10.5. Thank you!.

  • How to duplicate a mpegts stream into multiple other UDP streams using FFMPEG

    11 février 2016, par Jur_

    I'm experimenting with ffmpeg commandline to see to see if I can re-stream a mpegts udp stream in different resolutions.

    I succeed in re-streaming an incoming stream into a stream with a different resolution:

    ffmpeg -y -i "udp://234.5.6.7:1234" -vf scale=-1:320 -map 0 -acodec copy -dcodec copy -f mpegts udp://234.5.6.8:1234

    I would like to stream to multiple output mpegts streams in various resolutions. I could of course listen from multiple instances to the original broadcast and each stream to a different new endpoint and resolution, but it would be nicer to achieve this with a single ffmpeg call.

    Trying to at least output to multiple streams I seem stuck on getting the following to run (even without changing the resolution:)

    ffmpeg -y -i "udp://234.5.6.7:1234" -f tee "[f=mpegts:map=0:acodec=copy:dcodec=copy]udp://234.5.6.8:1234|[f=mpegts:map=0:acodec=copy:dcodec=copy]udp://234.5.6.9:1234"

    This results in the following error:

    Output file #0 does not contain any stream

    Could it be that I'm providing the output parameters incorrectly? How would I fix the above line to generate two (or more) output streams?

  • Can't display live streaming video from mobile to wowza streaming software

    11 février 2016, par Muthukumar S

    You have to record frame are convert to video.mp4 files. i need rtmp url live streaming videos in mp4 format. but i work in java CV 1.1 . the mp4 and flv video is working. and it can't display(any video format) in wowza streaming engine software. thanks.

  • Ask to ffmpeg to wait the reconnection of rtp source

    11 février 2016, par Slayes

    I used this command to change the streaming parameters :

    ffmpeg -i rtp://192.168.0.12:1234 -timeout -1 -shortest -ac 2 -ar 16000 -acodec pcm_s16le -f rtp rtp://192.168.0.12:4567
    

    This is work well, ffmpeg wait the connection of the source to start.

    But i don't found the options to indicate at ffmpeg to wait the reconnection of the source if the connection has been cuted.

    Somebody know if this option exist ? Thank's in adavance.