Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg and Native Client [on hold]

    29 avril 2017, par Siwanka

    Anyone can help me to mixing two video files and audio file using ffmpeg and that should run within NaCl. Is it possible to get code sample for this or how to configure or any guidance highly appreciate.

  • Forward HLS Stream - Solution needed

    29 avril 2017, par Chris

    i'm receiving a HLS/AppleHTTP stream with FFmpeg. The source stream looks like:

    Input #0, hls,applehttp, from 'http://example.com/hls/index.m3u8':
       Duration: 00:00:00.09, start: 42870.540944, bitrate: 91 kb/s
       Program 0
       Metadata:
          variant_bitrate : 0
       Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 12.50 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 114 kb/s
       Stream #0:2: Unknown: none ([21][0][0][0] / 0x0015)
    

    I need to forward this kind of stream with FFmpeg to a Stream Server. My problem is, how to do it with FFmpeg without encoding and have high CPU usage (i think -video copy -audio copy). Second, which Streaming Server Software is the best (low cpu usage) to recieve the stream and send it to the users as HLS stream?

  • Transcoding fMP4 to HLS while writing on iOS using FFmpeg

    29 avril 2017, par bclymer

    TL;DR

    I want to convert fMP4 fragments to TS segments (for HLS) as the fragments are being written using FFmpeg on an iOS device.

    Why?

    I'm trying to achieve live uploading on iOS while maintaining a seamless, HD copy locally.

    What I've tried

    1. Rolling AVAssetWriters where each writes for 8 seconds, then concating the MP4s together via FFmpeg.

      What went wrong - There are blips in the audio and video at times. I've identified 3 reasons for this.

      1) Priming frames for audio written by the AAC encoder creating gaps.

      2) Since video frames are 33.33ms long, and audio frames 0.022ms long, it's possible for them to not line up at the end of a file.

      3) The lack of frame accurate encoding present on Mac OS, but not available for iOS Details Here

    2. FFmpeg muxing a large video only MP4 file with raw audio into TS segments. The work was based off the Kickflip SDK

      What Went Wrong - Every once in a while an audio only file would get uploaded, with no video whatsoever. Never able to reproduce it in-house, but it was pretty upsetting to our users when they didn't record what they thought they did. There were also issues with accurate seeking on the final segments, almost like the TS segments were incorrectly time stamped.

    What I'm thinking now

    Apple was pushing fMP4 at WWDC this year (2016) and I hadn't looked into it much at all before that. Since an fMP4 file can be read, and played while it's being written, I thought that it would be possible for FFmpeg to transcode the file as it's being written as well, as long as we hold off sending the bytes to FFmpeg until each fragment within the file is finished.

    However, I'm not familiar enough with the FFmpeg C API, I only used it briefly within attempt #2.

    What I need from you

    1. Is this a feasible solution? Is anybody familiar enough with fMP4 to know if I can actually accomplish this?
    2. How will I know that AVFoundation has finished writing a fragment within the file so that I can pipe it into FFmpeg?
    3. How can I take data from a file on disk, chunk at a time, pass it into FFmpeg and have it spit out TS segments?
  • FFmpeg send stream on a web server

    29 avril 2017, par Luzwitz

    For stream my screen, i used :

    ffmpeg -s 1920x1080 -f X11grab -i :0.0+0,0 -codec:v libvpx -b:v 4M -b:a libvorbis -crf 20 capture.webm
    

    This command save the stream in a file : capture.webm.

    But now, I want send stream on a udp server. So i make this command :

    ffmpeg -s 1920x1080 -f X11grab -i :0.0+0,0 -codec:v libvpx -b:v 4M -b:a libvorbis -crf 20 -f webm udp://192.168.232.2:8080
    

    But it doesn't run.

  • Running matplotlib animation on Mac using Spyder : says to install ffmpeg

    28 avril 2017, par Addem

    I installed Anaconda on a new Mac, made a simple animation with matplotlib like

    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)
    
    
    anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])
    
    plt.show()
    

    When I run it, it tells me to install ffmpeg. I tried using these instructions: http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html But the instructions were unclear about what I was supposed to download, especially when it got to the part about a "patch". This also just feels insanely complicated for something that seems like it should be much simpler. I also tried following some instructions for installing ffmpeg using Homebrew but the instructions were again poorly written so that some of the buttons it said should be there weren't. I tried to figure it out by guessing what I should do, and it seemed to work but with a lot of warning messages. By the end of the process, when I type into a terminal

    which ffmpeg
    

    it returns /usr/local/bin/ffmpeg. However, even after restarting Spyder and re-running the code, it still tells me to install ffmpeg. I also navigated to /usr/local/bin and it doesn't have a folder ffmpeg. So my guess is that ffmpeg didn't install.

    I read in the matplotlib documentation that Anaconda doesn't give a build for Python that is appropriate, something about a "framework" build (http://matplotlib.org/faq/osx_framework.html). But it says that in Anaconda you can install it easily by running conda install python.app which I did and it worked. It then says to use pythonw rather than python. I'm not really sure what this means, because in Spyder I don't run scripts from the terminal. I tried navigating to the file anyway and running it with

    pythonw anim.py
    

    and it mysteriously gave me an I/O error.

    Do I really need to install ffmpeg or is there some simpler fix?

    If I do need to install ffmpeg, where get I get up-to-date instructions that make the process clear?