Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet), the frameFinished is 0 most of the time why ?

    26 mai 2014, par Whoami

    I received a packet from rtsp by av_read_frame and decode it through

    avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet)
    

    After decoding i am checking the value of frameFinished.

    Most of the time i get the value of frameFinished is zero. May be around 50% of the packet.

    Could you kindly hint me what could be the reason ?

    is this issue in any way related to 'I', 'P', 'B' packet types ?

  • SOLVED - AVI to MP4 - ffmpeg conversion

    26 mai 2014, par Emmanuel Brunet

    I'm running a debian 7.5 machine with ffmpeg-2.2 installed following these instructions

    Issue

    I'm trying to display a mp4 video inside my browser. The original file has an AVI container format. I can successfully convert it to mp4 and the targetfile is readable (video + sound) with the totem movie player. So I thought everything would be OK displaying the bellow page

    HTML5 web page

    
    
        
    
    
    
    
    

    Input probe

    $ ffprobe -show_streams input.avi
    
      Duration: 00:08:22.90, start: 0.000000, bitrate: 1943 kb/s
        Stream #0:0: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 64 kb/s
        Stream #0:1: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x540 [SAR 1:1 DAR 4:3], 1870 kb/s, 29.97 fps, 25 tbr, 29.97 tbn, 25 tbc
    

    Convert

    $ ffmpeg -y -fflags +genpts -i input.avi -acodec copy -vcodec copy ouput.mp4

    Html browser

    Opening the above html file plays sound but no video is displayed.

    When I use other .mp4 files, videos succesfully displayed so I'm sure I face a conversion issue.

    Not : I've tryed a lot of other ffmpeg options but without success.

    Any idea ?

    Thanks in advance.

  • Removing false colors

    25 mai 2014, par Peak Reconstruction Wavelength

    I encountered this problem when my video recording device got warmer.

    Example Picture

    How do I fill all areas that have that same colored violet or green with a gradient between two right(as in intended) colors(the way logoaway solutions do it) or using some other method that recreates the original image using ffmpeg?

    What I tried:

    AVISynth (http://forum.doom9.org/showthread.php?p=1681321#post1681321) but combining AVS with ffmpeg seems like a bad idea and given the huge amount of ffmpeg's filters I presume ffmpeg offers a more efficient solution.

  • Python script creates too short video using ffmpeg

    25 mai 2014, par Majzlik

    I use python script to create multiple pictures and call ffmpeg to create video. But there is a problem, because ffmpeg use just few pictures (about 7 - 10 from 160), but throws no error. I've tried the same command from commandline and video was correct. I'm calling ffmpeg this way:

    ffmpeg_call = ["ffmpeg", "-r", str(FPS), "-b", "16777216", "-y", "-i", "./sample_%05d.png", FILEOUTNAME + ".mp4"]
    subprocess.call(ffmpeg_call)
    

    and this was command in commandline:

    ffmpeg -r 25 -b 16777216 -y -i ./sample_%05d.png animation.mp4
    

    I've printed these commands to compare and they were the same, so there has to be problem in ffmpeg + python cooperation. Don't you know, how to fix it?

    UPDATE:

    this is log from ffmpeg:

    ffmpeg version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav     developers
      built on Feb  6 2014 20:56:59 with gcc 4.6.3
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    Input #0, image2, from '/tmp/tmpRKxT6s/ampgraph/tmp/sample_%05d.png':
    Duration: 00:00:00.44, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: png, pal8, 640x480, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Incompatible pixel format 'pal8' for codec 'mpeg4', auto-selecting format 'yuv420p'
    [buffer @ 0x19e18a0] w:640 h:480 pixfmt:pal8
    [avsink @ 0x19ee1c0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
    [scale @ 0x19e2fc0] w:640 h:480 fmt:pal8 -> w:640 h:480 fmt:yuv420p flags:0x4
    Output #0, mp4, to './ampgraph/animation.mp4':
      Metadata:
        encoder         : Lavf53.21.1
        Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 25 tbn, 25 tbc
    Stream mapping:
      Stream #0.0 -> #0.0
    Press ctrl-c to stop encoding
    frame=   11 fps=  0 q=2.5 Lsize=      46kB time=0.44 bitrate= 859.1kbits/s    
    video:45kB audio:0kB global headers:0kB muxing overhead 1.906569%
    
  • Can't save matplotlib animation (ffmpeg)

    25 mai 2014, par renger

    I am trying to get a simple animation saved using ffmpeg. I followed a tutorial to install ffmpeg, and I can now access it from the command prompt.

    Now I run this piece of code:

    import numpy as np
    from matplotlib import pyplot as plt
    from matplotlib import animation
    
    fig = plt.figure()
    ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
    line, = ax.plot([], [], lw=2)
    
    def init():
        line.set_data([], [])
        return line,
    
    def animate(i):
        x = np.linspace(0, 2, 1000)
        y = np.sin(2 * np.pi * (x - 0.01 * i))
        line.set_data(x, y)
        return line,
    
    anim = animation.FuncAnimation(fig, animate, init_func=init,
                                   frames=200, interval=20, blit=True)
    
    mywriter = animation.FFMpegWriter()
    anim.save('mymovie.mp4',writer=mywriter)
    
    plt.show()
    

    I get this error:

    Traceback (most recent call last):
      File "", line 1, in 
       File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 523, in runfile
        execfile(filename, namespace)
      File "C:\Users\Renger\.xy\startups\b.py", line 23, in 
        anim.save('mymovie.mp4',writer=mywriter)
      File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 609, in save
        with writer.saving(self._fig, filename, dpi):
      File "C:\Python27\lib\contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 166, in saving
        self.setup(*args)
      File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 156, in setup
        self._run()
      File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 183, in _run
        stdin=subprocess.PIPE)
      File "C:\Python27\lib\subprocess.py", line 711, in __init__
        errread, errwrite)
      File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
        startupinfo)
    WindowsError: [Error 2] Het systeem kan het opgegeven bestand niet vinden
    

    The last dutch sentence does mean something like: The system can't find the specified file.

    What do these errors mean, and how can I solve them?

    Best,