Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to optimize the decoder performance in ffmpeg ?

    16 mars 2018, par air

    Hi I am trying to get the non-decoded h264 format to use in another client application using ffmpeg command. The consumer application simply reads the h264. Now How do I optimize the below command ? My machine has GPU, I see only CPU is used, is there something I can add ?

     ffmpeg -pix_fmt yuv420p -hide_banner  -y -f v4l2 -vcodec h264 -video_size 1280x1020 -i /dev/video0 out.h264
    

    The verbose printed for reference is pasted below -

    user@ubuntu$  ffmpeg -pix_fmt yuv420p -hide_banner  -y -f v4l2 -vcodec h264 -video_size 1280x1020 -i /dev/video0 out.h264
        [video4linux2,v4l2 @ 0x17e0a20] The V4L2 driver changed the video from 1280x1020 to 1280x720
        Input #0, video4linux2,v4l2, from '/dev/video0':
          Duration: N/A, start: 871.695509, bitrate: N/A
            Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc
        No pixel format specified, yuvj420p for H.264 encoding chosen.
        Use -pix_fmt yuv420p for compatibility with outdated media players.
        [libx264 @ 0x1b80ac0] using SAR=1/1
        [libx264 @ 0x1b80ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
        [libx264 @ 0x1b80ac0] profile High, level 3.1
        Output #0, h264, to 'out.h264':
          Metadata:
            encoder         : Lavf56.40.101
            Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 30 tbn, 30 tbc
            Metadata:
              encoder         : Lavc56.60.100 libx264
        Stream mapping:
          Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
        Press [q] to stop, [?] for help
        frame= 1242 fps= 30 q=-1.0 Lsize=    4092kB time=00:00:41.33 bitrate= 811.1kbits/s dup=0 drop=4    
        video:4092kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
        [libx264 @ 0x1b80ac0] frame I:5     Avg QP:17.23  size: 59416
        [libx264 @ 0x1b80ac0] frame P:341   Avg QP:20.29  size:  8344
        [libx264 @ 0x1b80ac0] frame B:896   Avg QP:24.94  size:  1170
        [libx264 @ 0x1b80ac0] consecutive B-frames:  3.4%  1.1%  0.5% 95.0%
        [libx264 @ 0x1b80ac0] mb I  I16..4: 21.7% 46.7% 31.6%
        [libx264 @ 0x1b80ac0] mb P  I16..4:  1.8%  1.9%  0.4%  P16..4: 33.2%  5.0%  3.9%  0.0%  0.0%    skip:53.8%
        [libx264 @ 0x1b80ac0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 18.8%  0.6%  0.1%  direct: 0.5%  skip:79.8%  L0:41.7% L1:55.6% BI: 2.7%
        [libx264 @ 0x1b80ac0] 8x8 transform intra:46.9% inter:56.0%
        [libx264 @ 0x1b80ac0] coded y,uvDC,uvAC intra: 33.9% 42.8% 12.2% inter: 3.0% 5.9% 0.1%
        [libx264 @ 0x1b80ac0] i16 v,h,dc,p: 14% 44% 12% 30%
        [libx264 @ 0x1b80ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 32% 29%  2%  4%  3%  5%  2%  5%
        [libx264 @ 0x1b80ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 30% 13%  4%  8%  6%  7%  3%  5%
        [libx264 @ 0x1b80ac0] i8c dc,h,v,p: 57% 23% 17%  2%
        [libx264 @ 0x1b80ac0] Weighted P-Frames: Y:1.8% UV:0.0%
        [libx264 @ 0x1b80ac0] ref P L0: 65.9%  4.5% 21.6%  8.0%  0.1%
        [libx264 @ 0x1b80ac0] ref B L0: 88.2% 10.0%  1.9%
        [libx264 @ 0x1b80ac0] ref B L1: 95.6%  4.4%
        [libx264 @ 0x1b80ac0] kb/s:809.79
    
  • ffmpeg - how to make a video to have no audio in laravel

    16 mars 2018, par kodfire
    ffmpeg -i input_file.mp4 -an -vcodec copy output_file.mp4
    

    How can I change it to something like this below?

    FFMpeg::fromDisk('local')
    ->open($filePath.$fileName)
    ->export()
    ->toDisk('local')
    ->inFormat(new \FFMpeg\Format\Video\X264('libmp3lame', 'libx264'))
    ->save($converted);
    
  • Where the ffmpeg.exe is located in when downloading the archive ?

    16 mars 2018, par Daniel Hamutel

    I went to the official site:

    ffmpeg

    I downloaded first the windows build version then i downloaded the ffmpeg-2.8.3.tar.bz2 file in both i didn't find the exe.

  • Ffmpeg http slow Startup Delay

    16 mars 2018, par Jan

    I need a http stream output with very fast start up Delay (100ms) And Constant Traffic. And I only want to use the http stream with vlc... so not for Browser usage. My input stream has a Bitrate 3-4mbit. With hls I get the 100ms switching time but not constant traffic. I already have traffic eruption... in one second high traffic and then nothing. But I need a constant output.

    So I tried it with nodejs and ffmpeg fluent but the starting time is not so good(Not so fast like hls)

    This is my

    // How to Use
    // 1. Create package.json with `npm init`
    // 2. Install dependencies with `npm i fluent-ffmpeg express`
    // 3. Start with `node ffmpegToWeb.js`
    // 4. Open VLC and "Open Network Stream".
    // 5. Input the following without quotes : `http://127.0.0.1:8001` and start.
    
    const ffmpeg = require('fluent-ffmpeg')
    const config = {
      port: 8001,
      url: 'url here'
    }
    
    let ffmpegObj = ffmpeg(config.url)
      .videoCodec('copy')
      .audioCodec('copy')
      .outputOptions([
        '-y',
        '-ac 2',
        '-sn',
        '-f mpegts'
      ])
      .inputOptions([
        '-re',
        '-nostdin',
        '-hide_banner',
        '-probesize 5000000',
        '-analyzeduration 15000000'
      ])
      .on('start', function (commandLine) {
        console.log('Starting ffmpeg with command: ' + commandLine)
      })
      .on('error', (err) => {
        console.log('ffmpeg error', err)
      })
      .on('end', () => {
        console.log('ffmpeg end')
      })
      .on('progress', (stats) => {
        // console.log(stats)
      })
    let currentChunk = {}
    let ffstream = ffmpegObj.pipe()
    ffstream.on('data', (buffer) => {
      currentChunk = buffer
      process.emit('ffmpeg-data', buffer)
    })
    
    // web app
    console.log('Starting Express Web Server on Port ' + config.port)
    const express = require('express')
    const app = express()
    const http = require('http')
    const httpServer = http.createServer(app)
    
    app.get('/', function (req, res) {
      console.log('client connected:', req.headers['user-agent'])
      let contentWriter = (buffer) => {
        res.write(buffer)
      }
      res.setHeader('Connection', 'close')
      res.setHeader('Cache-Control', 'no-cache')
      res.setHeader('Pragma', 'no-cache')
      res.setHeader('Content-Type', 'video/mp2t')
    
      // write current chunk before the first data event occurs
      if (currentChunk.length > 0) {
        res.write(currentChunk)
      }
      process.on('ffmpeg-data', contentWriter)
    
      req.on('close', function () {
        console.log('client disconnected:', req.headers['user-agent'])
        process.removeListener('ffmpeg-data', contentWriter)
      })
    })
    
    httpServer.listen(config.port) 
    
  • How to censor audio from a video file using ffmpeg ? [closed]

    16 mars 2018, par Bravo Ragazo

    How To censor audio from a video file using ffmpeg?