Newest 'ffmpeg' Questions - Stack Overflow

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

Articles published on the website

  • how to convert multiple .dav files in a directory to .mp4

    6 December, by pgp

    I have a bunch of .dav files in a directory, need to convert all the files in the directory to .mp4 format. I'm on Linux btw, so looking for a commandline option preferably

  • Render SharpDX Texture2D in UWP application

    6 December, by Alex

    I'm implementing a solution for hardware-accelerated H264 decoding and rendering in the UWP application. I want to avoid copying from GPU to CPU. The solutions consists of 2 parts:

    1. C library that decodes the H264 stream using ffmpeg
    2. UWP/C#/SharpDX application to receive encoded data, pinvoke library and then render decoded frames.

    I receive encoded data in the C# application and send it to the C library to decode and get the pointer to the frame back using pinvoke.

    C part looks good so far. I managed to receive pointer to the decoded frame in GPU in the C library:

    // ffmpeg decoding logic
    ID3D11Texture2D* texturePointer = (ID3D11Texture2D*)context->frame->data[0];
    

    I managed to receive this pointer in C# code and create SharpDX texture from it.

    var texturePointer = decoder.Decode(...data...); // pinvoke
    if (texturePointer != IntPtr.Zero)
    {
        var texture = new Texture2D(texturePointer); // works just perfect
    }
    

    Now I need to render it on the screen. My understanding is that I can create class that extends SurfaceImageSource so I can assign it as a Source of XAML Image object. It can be something like this:

    public class RemoteMediaImageSource : SurfaceImageSource
    {
        public void BeginDraw(IntPtr texturePointer)
        {
            var texture = new Texture2D(texturePointer);
            // What to do to render texture in GPU to the screen?
        }
    }
    

    Is my assumption correct? If yes, how do I exactly do the rendering part (code example would be highly appreciated)?

  • Loss less conversion using FFMPEG in react native while adding logo to video

    6 December, by Rishav Kumar

    I am using RN-FFMPEG to embed a thumbnail in a video using FFmpeg. The problem is that the video quality is highly deteriorated while adding a logo. Also, the issue is logo gets highly stretched and distorted in landscape videos but works great in portrait video.

    Can someone help me to have a max-width and max-height to the watermark along with high processing time with lossless conversion?

    RNFFmpeg.execute('-i ' + video + ' -i ' + logo +' -filter_complex overlay=main_w-overlay_w-25:main_h-overlay_h-25 -codec:a copy /storage/emulated/0/ABC/ABC-' + name + '.mp4')

    This is my FFMPEG code

    Here, video is path of video file. logo is path of the watermark name is any random number

    Any intelligent person doing downvote please let me know the reason.

  • Convert chapters from xml to ffmetadata?

    6 December, by Soul Spark

    I wanted to add chapters to my encoded mkvs, but I get *.xml files when I download it from online. So is there any way to convert it to FFMETADATAFILE so that when I encode it using ffmpeg I can add chapters to my mkv??

    Sample Input

    <?xml version="1.0"?>
    
    
    
    -
    
    
    -
    
    1
    
    0
    
    
    -
    
    95534594
    
    00:00:00.000000000
    
    00:01:30.000000000
    
    0
    
    1
    
    
    -
    
    Chapter 1
    
    und
    
    
    
    
    
    
    
    
    
    
    

    Sample Output

    ;FFMETADATA1
    title=bike\\shed
    ;this is a comment
    artist=FFmpeg troll team
    
    [CHAPTER]
    TIMEBASE=1/1000
    START=0
    #chapter ends at 0:01:00
    END=60000
    title=chapter \#1
    [STREAM]
    title=multi\
    line
    

    By the way I use ffmpeg in cli mode only.

  • Ffmpeg Multiple Crop

    6 December, by megaimd mega

    How can I make crop in and out from 3 to 3 seconds to a video. for Exemple:

    The First 3 sec Of the video to be original,

    The next 3 sec of the video to be CROP crop=iw-684:ih-516,scale=1280:720

    The next 3 sec Of the video to be original,

    The next 3 sec of the video to be CROP crop=iw-684:ih-516,scale=1280:720

    so on, until the end of the video Please Help Me