Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Delphi opencv ocvFFMpegIPCamSource to a bitmap ?

    17 février 2020, par Linces Marques

    There is a way to a capture/convert ocvFFMpegIPCamSource stream to a bitmap?

    First I try to do this:

    FrameBitmap := TBitmap.Create;
    FrameBitmap.PixelFormat := pf24bit;
    
    Image5.Picture.Graphic := IplImage2Bitmap(ocvView1.Image, FrameBitmap);
    

    // Image5 is my bitmap.

    Obviously is geting a error, because "ocvView1.Image" is of type "IocvImage" and the first parameter of the function IplImage2Bitmap needs a type "pIpIImage"

    I missed something in the middle of the process..

    Second i try using "cvImage2Bitmap":

    FrameBitmap := TBitmap.Create;
    FrameBitmap.PixelFormat := pf24bit;
    
    Image5.Picture.Graphic := cvImage2Bitmap(ocvView1.Image, FrameBitmap);
    

    Again, needs a type "pIpIImage" and i am trying to pass a "IocvImage"

    I cannot see what is missing.

    There is a way to make this conversion?

    I need to do this directly from ocvFFMpegIPCamSource component, or from ocvView component?

  • FFMPEG not found error while attempting to implement ffmpeg into discord bot

    17 février 2020, par Ravenr_

    While implementing a music feature into my node.js discord.js discord bot, I got an error claiming that it cant find FFMPEG. I reinstalled ffmpeg 3 times to no avail.

    This is the full error

    2020-02-17T01:48:30.403766+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Error: FFMPEG not found
    2020-02-17T01:48:30.403797+00:00 app[worker.1]:     at Function.selectFfmpegCommand (/app/node_modules/prism-media/src/transcoders/ffmpeg/Ffmpeg.js:46:13)
    2020-02-17T01:48:30.403798+00:00 app[worker.1]:     at new FfmpegTranscoder (/app/node_modules/prism-media/src/transcoders/ffmpeg/Ffmpeg.js:7:37)
    2020-02-17T01:48:30.403798+00:00 app[worker.1]:     at new MediaTranscoder (/app/node_modules/prism-media/src/transcoders/MediaTranscoder.js:10:19)
    2020-02-17T01:48:30.403799+00:00 app[worker.1]:     at new Prism (/app/node_modules/prism-media/src/Prism.js:5:23)
    2020-02-17T01:48:30.403799+00:00 app[worker.1]:     at new VoiceConnection (/app/node_modules/discord.js/src/client/voice/VoiceConnection.js:46:18)
    2020-02-17T01:48:30.403800+00:00 app[worker.1]:     at /app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:63:22
    2020-02-17T01:48:30.403800+00:00 app[worker.1]:     at new Promise ()
    2020-02-17T01:48:30.403801+00:00 app[worker.1]:     at ClientVoiceManager.joinChannel (/app/node_modules/discord.js/src/client/voice/ClientVoiceManager.js:45:12)
    2020-02-17T01:48:30.403801+00:00 app[worker.1]:     at VoiceChannel.join (/app/node_modules/discord.js/src/structures/VoiceChannel.js:130:30)
    2020-02-17T01:48:30.403802+00:00 app[worker.1]:     at Object.execute (/app/commands/play.js:31:64)
    2020-02-17T01:48:30.404044+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
    2020-02-17T01:48:30.404052+00:00 app[worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    

    This is the code

    const ytdl = require("ytdl-core");
    module.exports = {
        name: 'play',
        description: 'initiates music methods of the bot',
        execute(msg, args){
            var servers = {};
    
            function play(connection, msg){
                var server = servers[msg.guild.id];
    
                server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));
                server.queue.shift();
    
                server.dispatcher.on("end", function(){
                    if(server.queue[0]){
                        play(connection, msg);
                    }else{
                        connection.disconnect();
                    }
                });
    
    
            }
            if(!args[1]) return msg.channel.send("you need to provide a link");
            if(!msg.member.voiceChannel) return msg.channel.send("You must be in a voice channel to use this feature");
            if(!servers[msg.guild.id]) servers[msg.guild.id] = {
                queue: []
            }
            var server = servers[msg.guild.id];
            server.queue.push(args[1]);
            if(!msg.guild.voiceConnection) msg.member.voiceChannel.join().then(function(connection){
                play(connection, msg);
            })
        }
    }
    

    I have no idea what the issue is. I am using heroku to deploy if that matters at all.

  • MovieWriter FFwriter unavailable. Trying to use pillow instead

    17 février 2020, par Life is Good

    I have created a bar chart race in Matplotlib and now I am trying to save it into a gif file. I have imported the relevant library:

    import matplotlib.animation as animation
    plt.rcParams['animation.ffmpeg_path'] = '‪C:\\Program Files\\FFmpeg\\bin\\ffmpeg.exe'
    FFwriter = animation.FFMpegWriter()
    

    Here is the code I used to create my animation:

    fig, ax = plt.subplots(figsize=(15, 8))
    animator = animation.FuncAnimation(fig, draw_barchart, frames=range(1999, 2015))
    HTML(animator.to_jshtml()) 
    

    However, when I searched for the writers, there are only two of them:

    animation.writers.list()
    

    enter image description here

    I had already installed FFmpeg following a tutorial on Wikihow, and I am also able to run FFmpeg from the command line, so I don't understand why it is not showing up. When I try to save my animation into a gif, I get this error message: enter image description here

    Would anybody be familiar with this error message, please? Thank you very much.

  • Accurate cut of mp4 file using FFmpeg

    16 février 2020, par user12129980

    I want to cut mp4 video to seperate videos by seconds in the example:

    00:00:00 - 00:00:01
    00:00:01 - 00:00:02
    00:00:02 - 00:00:10.01
    

    This is the commands I used:

    ffmpeg.exe -i 10sec.mp4 -ss 00:00:00 -t 00:00:01 -async 1 -strict -2 -c copy 0002.mp4
    ffmpeg.exe -i 10sec.mp4 -ss 00:00:01 -t 00:00:02 -async 1 -strict -2 -c copy 0003.mp4
    ffmpeg.exe -i 10sec.mp4 -ss 00:00:02 -t 00:00:10.01 -async 1 -strict -2 -c copy 0004.mp4
    

    And the files I got are: 1.3 second long 2.6 second long 8.5 second long

    So obviously the cutting it's not accurate...

    I understand it's hes something to do with the key frame, so I want to decompress the original file (mpeg with very high quality) to be not compress at all (so every frame will be key frame) and then do the cutting on it (so now the cutting will be accurate)

    The reason accuracy is so important to me is because after the cutting I must rejoin the slices to the single movie, and currently I just have replication in the movie I create from the slices.

    I tried the .avi version:

    ..\ffmpeg.exe -i 10sec.mp4 -vcodec rawvideo -acodec copy uncompressed.mp4
    

    it's obviously failed duo to :

     [mp4 @ 091f1300] Could not find tag for codec rawvideo in stream #0, codec not currently supported in container
     Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
     Error initializing output stream 0:0 --
    

    So my q. is, how can I accurate slice a file using ffmpeg (I have the pkt_pts as well as the time I want to slice at, so if it's possible to accurate cut by pkt_pts it also will helkp me)?

  • How to get motion vector via opencv/ffmpeg

    16 février 2020, par william007

    How to get motion vector with opencv or via ffmpeg library? What are the motion vector algorithms that are supported in opencv/ffmpeg? (Are they state-of-the-art?)