Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFmpeg error when trying to stream file into it

    15 décembre 2015, par nadermx

    I'm trying to put a stream into a ffmpeg pipe.

    The issue I am having is that when I send the data to ffmpeg I get a error 127

    It also shows /bin/sh: 2: -acodec: not found

    Here is the console log I'm running via python

    from subprocess import Popen, PIPE
    from flask import Flask, stream_with_context, request, Response
    from signal import signal, SIGPIPE, SIG_DFL
    signal(SIGPIPE,SIG_DFL)
    
    def console(cmd, add_newlines=False):
        p = Popen(cmd, shell=True, stdout=PIPE)
        while True:
            data = p.stdout.read()
            if add_newlines:
                data += '\n'
            yield data
    
            p.poll();
            if isinstance(p.returncode, int):
                if p.returncode > 0:
                    # return code was non zero, an error?
                    print 'error:', p.returncode
    
                break
    
            sleep(2)
    

    And here is the actual route I am running the application in.

    @app.route('/large.mp3')
    def generate_large_mp3():
        url = 'https://www.youtube.com/watch?v=zGEiJ44K3Oo'
        result = ''.join(data.strip() for data in console('youtube-dl --simulate --get-url %s' % url))
        mp3 = console('sudo ffmpeg -i %s -acodec libmp3lame  -f mp3 -' % result, add_newlines=True)
    
        return Response(stream_with_context(mp3), mimetype='video/mp3')
    

    Here is the error output

    /bin/sh: 2: https://r13---sn-ab5l6nes.googlevideo.com/videoplayback?id=cc6122278e0adcea: not found
    /bin/sh: 2: -acodec: not found
    ffmpeg version git-2015-12-10-3652dd5 Copyright (c) 2000-2015 the FFmpeg developers
      built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
      configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-openssl --enable-nonfree --enable-version3 --enable-gnutls
      libavutil      55. 10.100 / 55. 10.100
      libavcodec     57. 17.100 / 57. 17.100
      libavformat    57. 19.100 / 57. 19.100
      libavdevice    57.  0.100 / 57.  0.100
      libavfilter     6. 20.100 /  6. 20.100
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    [https @ 0x384d0a0] HTTP error 403 Forbidden
    https://r13---sn-ab5l6nes.googlevideo.com/videoplayback?id=cc6122278e0adcea: Server returned 403 Forbidden (access denied)
    127.0.0.1 - - [15/Dec/2015 00:55:59] "GET /large.mp3 HTTP/1.1" 200 -
    error: 127
    

    I have tried many different urls and all of them end up with the same issue. I have also tried installing every dependency I have been able to find and still no luck

  • Adjust framerate MPG4 in ffMpeg

    15 décembre 2015, par Gilles

    I'm trying to create a MPG4 movie from a bunch of png's. I want the movie to show one of the PNG-pictures every 1/5th second. So I tried the following command:

    ffmpeg -i ffmpeg_temp/%05d.png -r 5 video.mp4
    

    Now I get a movie of only 40 seconds, in which lot's of frames completely disappear.

    I have around a 1000 pictures and want that to be a movie of around 3 minutes (5 fps).

  • ffmpeg Concatention - negative pad values

    15 décembre 2015, par mmmyum

    I'm relatively new to ffmpeg and having an issue concatenating some videos.

    Occasionally, I'm running into an issue with my command that is producing negative pad values, preventing the concat from completing. Check out this gist for details and the command output.

    Brief summary is that I'm using filter_complex to scale down and/or pad videos. You can see the full commands in the above links, but here are examples of the filter text:

    [$count:v]scale=if(gt(ih\,iw)\,-2\,$VID_WIDTH):if(gt(ih\,iw)\,$VID_HEIGHT\,-2),pad=$VID_WIDTH:$VID_HEIGHT:(ow-iw)/2:(oh-ih)/2,setsar=sar=1/1[v$count];

    where $VID_WIDTH and $VID_HEIGHT are the smallest dimensions of the inputs.

    I'm concatenating hundreds of videos (in different groups), the vast majority of which work without issue - but occasionally I run into this negative pad values issue. I assume it's because the input width/height is larger than the output width/height, so it produces a negative value, but I'm not sure how to fix this - I need the videos to be centered.

    Other details:

    • most videos are shot on a cell phone, in a portrait orientation (some in landscape, but I'd like to stitch them in portrait anyways)

    • very rarely I run into a video rotated 90 degrees (larger width than height) - not sure how I should handle this, but one issue at a time

    • usually all videos have the same dimensions, but occasionally one or more videos in a group will have slightly different dimensions, sometimes just by a couple pixels (see attached gist for example)

    • scripting everything in bash right now

  • FFMPEG + HDFS - how to use ffmpeg libraries (.libs) to get file IO in and out of HDFS ?

    15 décembre 2015, par eric frazer

    I'm programming in C, C++, and need ffmpeg to read and write files to HDFS. I know ffmpeg can decompress from packets I already have, but I don't know how to get it to read from the header, or get it to write to my stream. I don't look forward to cracking open the source for ffmpeg and writing it myself. It'd be nice if ffmpeg had some ability to read/write from something that looks like an IStream. Has anybody done this? I also know about mounting the HDFS system on my local machine, but that's a last resort. Note this question IS specific, and it is about programming, not soliciting advice. Need insight into ffmpeg's .LIB API and how to get it to read/write from an object I point it to.

  • How to get a string representation of an audio AVStream in ffmpeg ?

    14 décembre 2015, par serg66

    I'm using ffmpeg. Consider the following piece of code:

    for(i=0; inb_streams; i++) {
            if (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
                //how do I get the language of the stream?          
            }
    }
    

    I found out that there is a LangEntry struct in libavformat (avlanguage file), there's also a table containing languages and their codes, seems it's just what I need. But I don't know how to use it. I couldn't find any examples of its usage. There are no reference to the LangEntry neither in AVStream, nor in AVCodecContext.