Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Convert any type of videos to MP4 php without ffmpeg [on hold]

    17 décembre 2017, par Khalid Askia

    I have a website on which I allow users to upload videos. But I'm using the HTML5 video tag and only MP4 videos can be played. So I want to convert any type of video to MP4. I'm on a shared hosting account so I can't have FFMPEG or anything else installed on the server. Is there another way to convert videos without these tools?

  • Enormous, constant memory consumption using VP9 codec in FFMPEG C++

    17 décembre 2017, par Sebastian Schon

    Using: https://github.com/ash3D/VideoRecorder Wrapped with: https://github.com/ash3D/UEVideoRecorder

    I added the VP9 codec to the "FindEncoder" function of the CVideoRecorder (part of the VideoRecorder repository). Using VP9 codec works generally, however the memory consumption is enormous and within a good 30 seconds, the memory usage goes up from 3GB to 6GB, upon which (round about) FFMPEG throws out of memory errors and aborts the encoding process. I started up the Diagnostics Tool of Visual Studio and it told me that avcodec.dll is holding all the memory, which is not released until the encoding is terminated (peacefully). The function within which the allocating call is executed is the CVideoRecorder::Encode() function, which inside it calls avcodec_send_frame().

    H264 and HVENC work fine with a constant memory consumption of around 300MB.

    I tried setting various settings on the VP9 codec like the bitrate, cfr and quality, none of which changed the behavior in any to me recognizable way.

  • How to create image with 2 images ffmpeg

    16 décembre 2017, par segoitz

    I want create with 2 or more images a unique image combining all images that i pass as parameter. I start proving with 2 parameters.

        firstpart = "/home/princebot/mazos/cartas/CannonCard.png"
        secondpart = "/home/princebot/mazos/cartas/FireballCard.png"
        a = subprocess.Popen(["ffmpeg","-i", firstpart, "-filter_complex", "scale=120:-1,","-i", secondpart, "-filter_complex","hstack" , "output.png"],stdout=subprocess.PIPE)
        a.communicate()[0].decode('utf-8')
    

    and the combine image dont create.

  • VideoCapture() returns None in opencv & install opencv with ffmpeg

    16 décembre 2017, par Wentai Chen

    System: UBUNTU 16.04
    Python version: 3.5

    I would like to use cv2.VideoCapture() function to process my mp4 file. However, when I run the script below, I always get a result of None, so I am not able to continue my work after.

    import cv2
    video_cap = cv2.VideoCapture('demo.mp4')
    ret,frame = video_cap.read()
    print(ret,frame)
    
    result: False,None
    

    By searching a lot I realized the problem: opencv is not properly installed with ffmpeg, so that the video function in opencv does not work.

    However I didn't find a efficient tutorial on how to properly install opencv. I wonder if anyone could help. Thank you!

  • Converted mp4 from gif didn't shows in web browser

    16 décembre 2017, par Stojan Kukrika

    I am trying to convert animated GIFs to MP4 files using ffmpeg. Only this convert GIF to MP4:

      exec('ffmpeg -i ' . $destinationPath . $filename . ' -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ' . $destinationPath . $newFilename);
    

    And I can play it in my pc when download it from server, but it's didn't want to pay in browser. Browser returns me this error: enter image description here

    After that GIF to MP4 converor I get one image for thumbnail image and that is works fine:

    exec("ffmpeg -i " . $destinationPath . $video . ".mp4 -ss  00:00:01.000 -vframes 1 ".storage_path().$folderNameThumb."/media.png");
    

    and it's shows me a valid frame of GIF. Can anybody help me how to fix this problem with video?

    ffprobe output
    ffprobe version 2.8.13 Copyright (c) 2007-2017 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16)
    configuration:
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
    

    Here is what I get from one MP4 file (run ffprobe filename.mp4):

     Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf56.40.101
    Duration: 00:00:02.16, start: 0.000000, bitrate: 593 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 500x312 [SAR 1:1 DAR 125:78], 589 kb/s, 8.33 fps, 8.33 tbr, 12800 tbn, 25 tbc (default)
    Metadata:
    handler_name    : VideoHandler
    

    Because I use Laravel this is method for return media:

    public function getGifImage(Media $media)
    {
        $path = storage_path() . '/uploads/gif/' . $media->content;
        if (file_exists($path)) {
            return response()->download($path, null, [], null);
        }
    }