Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • C# streaming h264 video [on hold]

    26 avril 2017, par mesomagik

    I'm developing server in C# to stream video. I have a custom device from which I receive stream containing h264 playload (I receive encoded byte array of .h264 video). I need to do some work on this video on server side and then restream it to browser. I have read something about ffmpeg but i'm not sure how to set byte array input to create rtsp stream. Is it possible to create RTP packets and send them via RTSP to some streaming engine? Or if it is possible to display directly restreamed via http bytes in browser? Or maybe I'm wrong and there is another solution for displaying h264 stream in browser.

  • OSError : [Errno 13] Permission denied when running python code called extract.py

    26 avril 2017, par aisunshinehui

    ffmpeg.py:

    def resize(videoName, resizedName):
        if not os.path.exists(videoName):
          print '%s does not exist!' % videoName
          return False
        # call ffmpeg and grab its stderr output
        p = subprocess.Popen([ffmpeg, "-i", videoName],stderr=subprocess.PIPE)
        out, err = p.communicate()
        # search resolution info
        if err.find('differs from') > -1:
          return False
        reso = re.findall(r'Video.*, ([0-9]+)x([0-9]+)', err)
        if len(reso) < 1:
           return False
        # call ffmpeg again to resize
        subprocess.call([ffmpeg, '-i', videoName, '-s', '160 x 120', resizedName])
        return check(resizedName)
    
     # check the video file is corrupted or not
     def check(videoName):
         if not os.path.exists(videoName):
            return False
         p = subprocess.Popen([ffmpeg, "-i", videoName], stderr=subprocess.PIPE)
         out, err = p.communicate()
         if err.find('Invalid') > -1:
            return False
         return True
    

    extract.py:

    def extract(videoName, outputBase):
        if not os.path.exists(videoName):
            print '%s does not exist!' % videoName
            return False
        if check_dup(outputBase):
            print '%s processed' % videoName
            return True
        resizedName = os.path.join(tmpDir, os.path.basename(videoName))
        if not ffmpeg.resize(videoName, resizedName):
            resizedName = videoName     # resize failed, just use the input video
        subprocess.call('%s %s | %s %s %s %s' % (dtBin, resizedName, fvBin, pcaList, codeBookList, outputBase), shell=True)
        return True
    
    def check_dup(outputBase):
        """
        Check if fv of all modalities have been extracted
        """
        featTypes = ['traj', 'hog', 'hof', 'mbhx', 'mbhy']
        featDims = [20, 48, 54, 48, 48]
        for i in range(len(featTypes)):
            featName = '%s.%s.fv.txt' % (outputBase, featTypes[i])
            if not os.path.isfile(featName) or not os.path.getsize(featName) > 0:
                return False
            # check if the length of feature can be fully divided by featDims
            f = open(featName)
            featLen = len(f.readline().rstrip().split())
            f.close()
            if featLen % (featDims[i] * 512) > 0:
                return False
        return True
    

    i run the extract.py in the terminal and error occurred as follows,then add sudo and run chmod 777 -R /usr/lib/python2.7 to change the permission but it doesn`t work!

    aisunshinehui@aisunshinehui:~/program/dtfv/script$ sudo python extract_fv.py /home/aisunshinehui/program/dtfv/script/videolist/video.txt

    /home/aisunshinehui/program/dtfv/script/output/ 1
    [sudo] password for aisunshinehui: 
        0 /home/aisunshinehui/program/dtfv/script/videolist
      Traceback (most recent call last):
          File "extract_fv.py", line 63, in 
            extract(videos[i], outputName)
          File "extract_fv.py", line 27, in extract
            if not ffmpeg.resize(videoName, resizedName):
          File "/home/aisunshinehui/program/dtfv/script/ffmpeg.py", line 17, in resize
            p = subprocess.Popen([ffmpeg, "-i", videoName], stderr=subprocess.PIPE)
          File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
            errread, errwrite)
          File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
            raise child_exception
        OSError: [Errno 13] Permission denied
    

    help me!

  • FFMPEG image to video with transition effects

    26 avril 2017, par Ravi Rupareliya

    I have used this command to concate multiple images with transition effects to create video.

    "-y -f concat -safe 0 -i  -filter_complex [0:0][1:0]concat=n=2:v=0:a=1[out] -map [v] -shortest -vf fps=40 -pix_fmt yuv420p 

    But it is showing error :

    Stream specifier ':0' in filtergraph description [0:0][1:0]concat=n=2:v=0:a=1[out] matches no streams.
    

    Here is my txt file

    file '/storage/emulated/0/image1.jpg'
    duration 5
    file '/storage/emulated/0/image2.jpg'
    duration 5
    file '/storage/emulated/0/image3.jpg'
    

    However if i am not applying any filter effect, it is successfully creating a video.

  • Any alternative of Ffmpeg for Youtube live streaming app ?

    26 avril 2017, par samir.k433

    In this youtube live streaming app they are using Ffmpeg for encoding audio and video, and then for streaming to server. It's somehow complex for me (specifically the build tasks).
    Is there any alternative instead of using Ffmpeg in this regard?

  • How to HTTP live stream from a continuous sequence of images [on hold]

    26 avril 2017, par alez

    I can get a continuous sequences of images from a camera. The camera is on a Windows machine and I grab the images via a C# SDK.

    I need to generate a video stream from these images, delivered via an http server.

    I can generate an udp video stream in mpegts format using ffmpeg. The web server is nginx on a linux machine, how can I use this stream to deliver the video on an HTML5 page? Also with software other than ffmpeg.

    P.S. I'm using ffmpeg via Process, but I could use a wrapper like FFmpeg.AutoGen.