Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • node.js fluent-ffmpeg - Video crop and resize

    22 janvier 2019, par Kacy

    I want to crop an area from a video, and then resize that cropped area. I'm using the fluent-ffmpeg npm module. Without the videoFilters() line, the code works perfectly to resize the video. But when attempting to apply the crop filter as seen in this post, I receive the error below. How do I get the crop filter to work?

    ffmpeg( filepath )
    .toFormat( 'mp4' )
    .videoCodec( 'libx264' )
    .audioCodec( 'aac' );
    .videoFilters('crop=1080:1080:399:0' ) //HOW DO I MAKE THIS WORK?
    .output( destination )
    .fps( 30 )
    .size( target_width + 'x' + target_height )
    .on( 'error', (error, stdout, stderr) => reject(error) )
    .on( 'end', resolve )
    .run();
    

    Error: ffmpeg exited with code 1: Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0

  • ffmpeg with double ethernet interfaces works wrong

    21 janvier 2019, par CharlesCui

    A server with double interfaces.

    1. One(eht0) is used for WAN which provides http/ssh services for internet users.

    2. The other(eth1) is used to receive multicast data from intranet.

    218.108.132.177 is public network gateway.

    125.210.198.1 is private network gateway.

    233.49.3.*/24 is multicast address.

    10.0.11.*/24 is the source of multicast data.

    When the route table is like below, ffmpeg can't read the udp data from eth1, ffmpeg hung up:

    rrca@rcasnap02:~$ route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
    125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
    default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
    default         125.210.198.1   0.0.0.0         UG    100    0        0 eth1
    

    or

    rrca@rcasnap02:~$ route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
    125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
    default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
    10.0.11.0       125.210.198.1   0.0.0.0         UG    100    0        0 eth1
    

    or

    rrca@rcasnap02:~$ route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
    125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
    default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
    233.49.3.0      125.210.198.1   255.255.255.0   UG    100    0        0 eth1
    

    I want to the ffmpeg work right,but now I think the two default route in route table disturb eachother, and I take a try, when the public gateway route is deleted, or the private gateway route is at the head of public default gateway route, ffmpeg works well, I think it read multicast from eth1.But the route table is not thus, ffmpeg can't read data from eth1, I think it read data on eth0(which is not private network interface).

    How to do ffmpeg works well with two interfaces at the same time?

  • How to get video length using ffmpeg

    21 janvier 2019, par Kevin

    I am getting the duration of video using following code,

    if (substr(php_uname(), 0, 7) == "Windows"){            
        $time = exec("{$ffmpeg} -i $path 2>&1 | findstr Duration"); 
    
        echo $time;
        exit;
    
        $duration = explode(":", $time);                
        $seconds = ($duration[0] * 3600) + ($duration[1] * 60) + round($duration[2]);   
        $minutes = $seconds/60;
        $real_minutes = floor($minutes);
        $real_seconds = round(($minutes-$real_minutes)*60);
        $length = $real_minutes.':'.$real_seconds;
    }
    

    $time shows the output like Duration: 00:00:06.52, start: 0.000000, bitrate: 350 kb/s but $duration shows only like Array ans $length shows 0:0 only for all videos. So how can i get video length please help me.

  • FFMPEG - UDP stream cannot be read by multiple instances

    21 janvier 2019, par Luca

    I'm getting a problem with FFMpeg, specifically with libavformat/udp protocol.

    Two application instances listen on the same port, and SO_REUSEADDR is setup correctly by opening the URL udp://0.0.0.0:8888?reuse=1. The expected behavior is that both application receive the same MPEG 2 TS stream. I'm running on Windows.

    The actual behavior is that only one application get the data, while the other is currently waiting on the socket (select/poll does not notify any I/O). As soon as the receiving application is closed, the other starts receiving. Basically, only one process at time can pass the ff_network_wait_fd call, while the others recognize no I/O event. This can be described as UDP port stealing, on Windows platform, I think.

    The bind call is successful on both applications. This behavior is verified in ffplay compiled from the current sources and in my application which links libavformat (and its dependencies).

    I studied the FFMpeg UDP protocol source, and I can say that the actual system calls are correct. After all, I'm using this feature extensively on Windows using WinSock2 API and IOCP (something like dozen on sockets on the same port).

    So, what I'm asking here is: what can prevent a socket (with the SO_REUSEADDR option set) to receive incoming datagrams?

  • How to deal ffplay bein too slow playing iPhone's videos ?

    21 janvier 2019, par Mikhail T.

    Trying to play a 3840x2160 video recorded by an iPhone 7 (@30fps), I get frequent pauses -- in the video, music keeps playing.

    This happens both in firefox and when ffplay is invoked to play the file directly -- from command-line. The CPU is a dual E6700 @3.20GHz -- not super fast, but it should be able to play smoothly, shouldn't it? Video is Intel's "series 4" integrated chipset -- again, not a speed-daemon, but it should be adequate... Support for Intel's VA API is included.

    I build ffmpeg-4.1 from source using FreeBSD port. As you can see, the port has a maddening amount of options -- including several different ones for the 264-codec.

    Any suggestions for improving the decoding speed to the point, where it is watchable by a human? Thank you!