Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • What kind of stream GStreamer produce ?

    16 novembre 2014, par Max

    I use following 2 commands to stream video from Raspberry Pi

    RaPi

    raspivid -t 999999 -h 720 -w 1080 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=$RA-IP-ADDR port=5000 
    

    Linux Box

    gst-launch-1.0 -v tcpclientsrc host=$RA-IP-ADDR port=5000  ! gdpdepay !  rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false 
    

    But what kind of stream is it? Can I read it with OpenCV? or convert with avconv|ffmpeg nc $RA-IP-ADDR 5000 | avconv? or watch with VLC ?

  • ffmpeg : Concat multiple mp4 with no audible delay between clips

    16 novembre 2014, par Geuis

    I have several dozen mp4 clips that all have the same resolution, codecs, etc. I'm trying to combine them into a single file using ffmpeg, but there always seems to be a slight audio delay between the clips. My problem is that I'd like them to be seamless.

    Been following the steps here, https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files

    There's always a slight delay between the files, which is especially noticeable in the audio.

    Is there a recommended way to merge video files with no delay between them?

  • Calling python script using a php script accessed by the browser

    16 novembre 2014, par lfalmeida

    I have a php script which will receives uploaded videos and I would like to convert these videos using ffmpeg.

    I created a python script that receives parameters from php and calls ffmpeg to do the conversion.

    index.php

    <?php
    
    $data = array('filePath' => 'video.mov');
    
    $result = shell_exec('/usr/bin/python /home/fernando/Workspace/lab1/public_html/converter.py ' . escapeshellarg(json_encode($data)));
    

    converter.py

    #!/usr/bin/env python
    
    import os, sys, json, subprocess, string, random
    
    class Converter():
    
    WORK_DIR = '/home/fernando/Workspace/lab1/public_html'
    DESTINATION_DIR = '/home/fernando/Workspace/lab1/public_html/videos/'
    NEW_AUDIO = 'audio.mp3'
    
    def __init__(self, data):
        try:
            os.chdir(self.WORK_DIR)
            self.arg = data
        except:
            print "ERROR"
            sys.exit(1)     
    
    
    def generateId():
        return ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase ) for _ in range(12))      
    
    
    def convertVideo(self, type):
    
        convertedFileName = self.DESTINATION_DIR + self.generateId() + '.' + type
    
        typesDic = {
                    'mp4': ['/usr/bin/ffmpeg', '-loglevel', 'quiet', '-i', self.arg['filePath'], '-i', self.NEW_AUDIO, '-map', '0:0', '-map', '1', '-shortest', '-codec', 'copy', convertedFileName, '-y'], 
                    'ogv': ['/usr/bin/ffmpeg', '-loglevel', 'quiet', '-i', self.arg['filePath'], '-i', self.NEW_AUDIO, '-map', '0:0', '-map', '1', '-shortest', '-vcodec', 'libtheora', '-acodec', 'libvorbis',  convertedFileName, '-y'] 
                   }
    
        sp = subprocess.Popen(typesDic[type], shell=True)
    
        out, err = sp.communicate()
    
        if err:
            return {'status': 'error'}
    
        return {'status': 'success', 'filename': convertedFileName}
    
    
    
    
    data = json.loads(sys.argv[1])
    
    c = Converter(data)
    print c.convertVideo('mp4')
    print c.convertVideo('ogv')
    

    These codes are working the way I need, but only if I call them   via the command line.
    Ex: $ php index.php
    ou: $ ./converter.py '{"fileName": "video.avi"}'

    If I access via browser, which was my main intention, does not work.

    I wonder what is wrong?
    You can do this via browser?
    Would have a better approach?

    edited: Output from apache error log

    Use -h to get full help or, even better, run 'man ffmpeg'
    

    ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 53. 5.103 / 53. 5.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

    Use -h to get full help or, even better, run 'man ffmpeg' ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 53. 5.103 / 53. 5.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

    Use -h to get full help or, even better, run 'man ffmpeg'

  • Linux - FFMpeg - Cannot open libmp3lame.so.0

    15 novembre 2014, par h4ng4r18

    I have installed FFMpeg to ~/bin/ffmpeg. When I try to run ffmpeg:

    ...bin]$ ffmpeg
    ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file:
    No such file or directory
    

    however I can see this file

    bin]$ cd /usr/lib
    
    lib]$ dir
    cups        java-1.8.0        libavdevice.so.52      modprobe.d
    games       java-ext          libavdevice.so.52.2.3  python2.6
    gcc     jvm           libavformat.so.50      rpm
    java        jvm-commmon       libavformat.so.51      sendmail
    java-1.5.0  jvm-exports       libavutil.so.49        sendmail.sendmail
    java-1.6.0  jvm-private       libmp3lame.so.0        tmpfiles.d
    java-1.7.0  libavcodec.so.51  locale             yum-plugins
    

    I'm unsure of how to proceed at this stage - still quite new to Linux.

    The guide that I followed to get to this stage

    I am at the Symlinks stage and when I run

    sudo ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
    

    I get "ln: failed to create symbolic link ‘/usr/lib/libmp3lame.so.0’: File exists"

  • How to stream video from android over rtsp

    15 novembre 2014, par Robin

    I want to build an efficient streaming application for android. I came across at Java CV and Java CPP, which includes a wrapper for ffmpeg. I followed this piece of code and everthing works fine, using Wowza Streaming Server: https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java

    Howver, I want to stream the video to VLC Player directly, without the use of an external Streaming Server. Is there a way to stream the video over rtsp using the tools which are mentioned above? Does anyone have further information?

    Thanks for your help!