Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (99)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (11854)

  • How to create a video from image buffers using fluent-ffmpeg ?

    23 juin 2016, par Zacky Pickholz

    I’ve been trying to create a slideshow from a series of images using nodejs + fluent-ffmpeg, however it is not working well or consistently. ffmpeg occasionally emits "Error : ffmpeg exited with code 1 : pipe:0 : Invalid data found when processing input", and in case an eventual video (mp4) is created it seems to be missing images/frames.

    The process is as follows : images are loaded into memory, transformed resized to same dimensions using lwip, written sequentially into a passthrough stream, which is fed to ffmpeg as input.

    Relevant code snippets :

    var lwip = require('lwip');
    var ffmpeg = require('fluent-ffmpeg');
    var stream = require('stream');
    var imagesStream = new stream.PassThrough();

    ...

    image.batch()
               .contain(options.video.width, options.video.height, 'lanczos')
               .toBuffer(options.frames.format, {quality: 100}, (err, buffer) => {
                   if (err) {
                       throw ('error convering image to buffer. ' + err);
                   }
                   imagesStream.write(buffer, 'utf8');
                   resolve();
               });

    ...

       ffmpeg(imagesStream)
           .inputOptions('-framerate 1/' + options.frames.secsPerImage)
           .input(path.join(AUDIO_ROOT, options.audio.track))
           .save(path.join(path.join(OUTPUT_FOLDER, `${options.video.output.prefix}${timestamp}.${options.video.output.format}`)))
           .size(`${options.video.width}x${options.video.height}`)
           .on('start', () => {
               console.log('creating the clip now...')
           })
           .on('progress', (progress) => {
               var progPercent = Math.round(100 * progress.frames / (numImages * options.frames.secsPerImage * 25));
               progPercent = Math.min(progPercent, 100);
               console.log(`processing: ${progPercent}% done`)
           })
           .on('stderr', (line) => {
               console.error('ffmpeg error: ' + line);
           })
           .on('error', (error) => {
               reject('ffmpeg transcoding error: ' + error);
           })
           .on('end', () => {
               console.log('done!');
               resolve(true);
           })
           .run();

    And here is the output :

    "C:\Program Files (x86)\JetBrains\WebStorm 2016.1.1\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" vm2.js
    image count: 18
    image count: 6
    creating the clip now...
    ffmpeg error: ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
    ffmpeg error:   built with gcc 5.4.0 (GCC)
    ffmpeg error:   configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    ffmpeg error:   libavutil      55. 24.100 / 55. 24.100
    ffmpeg error:   libavcodec     57. 46.100 / 57. 46.100
    ffmpeg error:   libavformat    57. 38.100 / 57. 38.100
    ffmpeg error:   libavdevice    57.  0.101 / 57.  0.101
    ffmpeg error:   libavfilter     6. 46.101 /  6. 46.101
    ffmpeg error:   libswscale      4.  1.100 /  4.  1.100
    ffmpeg error:   libswresample   2.  1.100 /  2.  1.100
    ffmpeg error:   libpostproc    54.  0.100 / 54.  0.100
    creating the clip now...
    ffmpeg error: ffmpeg version N-80335-gcb46b78 Copyright (c) 2000-2016 the FFmpeg developers
    ffmpeg error:   built with gcc 5.4.0 (GCC)
    ffmpeg error:   configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    ffmpeg error:   libavutil      55. 24.100 / 55. 24.100
    ffmpeg error:   libavcodec     57. 46.100 / 57. 46.100
    ffmpeg error:   libavformat    57. 38.100 / 57. 38.100
    ffmpeg error:   libavdevice    57.  0.101 / 57.  0.101
    ffmpeg error:   libavfilter     6. 46.101 /  6. 46.101
    ffmpeg error:   libswscale      4.  1.100 /  4.  1.100
    ffmpeg error:   libswresample   2.  1.100 /  2.  1.100
    ffmpeg error:   libpostproc    54.  0.100 / 54.  0.100
    ffmpeg error: pipe:0: Invalid data found when processing input
    ffmpeg error:
    an error has occurred: ffmpeg transcoding error: Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input

    ffmpeg error: [jpeg_pipe @ 0000000000308fe0] Format jpeg_pipe detected only with low score of 6, misdetection possible!
    ffmpeg error: Input #0, jpeg_pipe, from 'pipe:0':
    ffmpeg error:   Duration: N/A, bitrate: N/A
    ffmpeg error:     Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 0.33 tbr, 0.33 tbn, 0.33 tbc
    ffmpeg error: [mp3 @ 0000000002fa0720] Estimating duration from bitrate, this may be inaccurate
    ffmpeg error: Input #1, mp3, from 'audio\avicii.mp3':
    ffmpeg error:   Metadata:
    ffmpeg error:     album           : True
    ffmpeg error:     genre           : House
    ffmpeg error:     copyright       : ℗ 2013 Avicii Music AB, / PRMD under exclusive license to Universal Music AB
    ffmpeg error:     encoded_by      : Oz
    ffmpeg error:     title           : Wake Me Up
    ffmpeg error:     artist          : Avicii
    ffmpeg error:     album_artist    : Avicii
    ffmpeg error:     disc            : 1/1
    ffmpeg error:     track           : 1/12
    ffmpeg error:     TYER            : 2013-09-13T07:00:00Z
    ffmpeg error:   Duration: 00:04:09.73, start: 0.000000, bitrate: 321 kb/s
    ffmpeg error:     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    ffmpeg error:     Stream #1:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 600x600 [SAR 305:305 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    ffmpeg error:     Metadata:
    ffmpeg error:       comment         : Cover (front)
    ffmpeg error: No pixel format specified, yuvj420p for H.264 encoding chosen.
    ffmpeg error: Use -pix_fmt yuv420p for compatibility with outdated media players.
    ffmpeg error: [libx264 @ 000000000030e860] using SAR=1/1
    ffmpeg error: [libx264 @ 000000000030e860] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    ffmpeg error: [libx264 @ 000000000030e860] profile High, level 4.0
    ffmpeg error: [libx264 @ 000000000030e860] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    ffmpeg error: [mp4 @ 0000000002ec6980] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    ffmpeg error:     Last message repeated 1 times
    ffmpeg error: Output #0, mp4, to 'output\clip_2016-06-22_06-17-25.mp4':
    ffmpeg error:   Metadata:
    ffmpeg error:     encoder         : Lavf57.38.100
    ffmpeg error:     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    ffmpeg error:     Metadata:
    ffmpeg error:       encoder         : Lavc57.46.100 libx264
    ffmpeg error:     Side data:
    ffmpeg error:       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    ffmpeg error:     Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
    ffmpeg error:     Metadata:
    ffmpeg error:       encoder         : Lavc57.46.100 aac
    ffmpeg error: Stream mapping:
    ffmpeg error:   Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    ffmpeg error:   Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
    ffmpeg error: frame=   75 fps=0.0 q=28.0 size=       0kB time=00:00:00.64 bitrate=   0.6kbits/s dup=74 drop=0 speed=1.09x    
    processing: 17% done
    ffmpeg error: frame=  150 fps= 97 q=28.0 size=     371kB time=00:00:03.64 bitrate= 835.6kbits/s dup=148 drop=0 speed=2.35x    
    processing: 33% done
    processing: 33% done
    ffmpeg error: frame=  150 fps= 73 q=28.0 size=     879kB time=00:00:07.36 bitrate= 977.8kbits/s dup=148 drop=0 speed= 3.6x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 59 q=28.0 size=     952kB time=00:00:18.36 bitrate= 424.7kbits/s dup=148 drop=0 speed=7.21x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 49 q=28.0 size=    1190kB time=00:00:32.99 bitrate= 295.3kbits/s dup=148 drop=0 speed=10.8x    
    ffmpeg error: frame=  150 fps= 42 q=28.0 size=    1409kB time=00:00:46.64 bitrate= 247.4kbits/s dup=148 drop=0 speed=13.1x    
    processing: 33% done
    processing: 33% done
    ffmpeg error: frame=  150 fps= 37 q=28.0 size=    1628kB time=00:01:00.30 bitrate= 221.1kbits/s dup=148 drop=0 speed=14.9x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 33 q=28.0 size=    1878kB time=00:01:15.83 bitrate= 202.8kbits/s dup=148 drop=0 speed=16.7x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 30 q=28.0 size=    2130kB time=00:01:31.64 bitrate= 190.4kbits/s dup=148 drop=0 speed=18.2x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 27 q=28.0 size=    2375kB time=00:01:47.18 bitrate= 181.5kbits/s dup=148 drop=0 speed=19.3x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 25 q=28.0 size=    2626kB time=00:02:03.15 bitrate= 174.7kbits/s dup=148 drop=0 speed=20.4x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 23 q=28.0 size=    2832kB time=00:02:16.20 bitrate= 170.3kbits/s dup=148 drop=0 speed=20.8x    
    ffmpeg error: frame=  150 fps= 21 q=28.0 size=    3063kB time=00:02:30.34 bitrate= 166.9kbits/s dup=148 drop=0 speed=21.3x    
    processing: 33% done
    processing: 33% done
    ffmpeg error: frame=  150 fps= 20 q=28.0 size=    3298kB time=00:02:44.93 bitrate= 163.8kbits/s dup=148 drop=0 speed=21.8x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 19 q=28.0 size=    3522kB time=00:02:58.93 bitrate= 161.3kbits/s dup=148 drop=0 speed=22.2x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 18 q=28.0 size=    3792kB time=00:03:15.83 bitrate= 158.6kbits/s dup=148 drop=0 speed=22.9x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 17 q=28.0 size=    4035kB time=00:03:31.11 bitrate= 156.6kbits/s dup=148 drop=0 speed=23.3x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 16 q=28.0 size=    4294kB time=00:03:47.62 bitrate= 154.5kbits/s dup=148 drop=0 speed=23.8x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 15 q=28.0 size=    4566kB time=00:04:04.87 bitrate= 152.7kbits/s dup=148 drop=0 speed=24.4x    
    processing: 33% done
    ffmpeg error: frame=  150 fps= 14 q=-1.0 Lsize=    4851kB time=00:04:09.73 bitrate= 159.1kbits/s dup=148 drop=0 speed=23.6x    
    ffmpeg error: video:826kB audio:3978kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.967442%
    ffmpeg error: [libx264 @ 000000000030e860] frame I:2     Avg QP:14.53  size:414604
    ffmpeg error: [libx264 @ 000000000030e860] frame P:38    Avg QP:16.59  size:   222
    ffmpeg error: [libx264 @ 000000000030e860] frame B:110   Avg QP:12.67  size:    69
    ffmpeg error: [libx264 @ 000000000030e860] consecutive B-frames:  1.3%  2.7%  0.0% 96.0%
    ffmpeg error: [libx264 @ 000000000030e860] mb I  I16..4: 25.5% 49.4% 25.1%
    ffmpeg error: [libx264 @ 000000000030e860] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.7%  0.0%  0.0%  0.0%  0.0%    skip:99.2%
    ffmpeg error: [libx264 @ 000000000030e860] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 1.2% L1:98.8% BI: 0.0%
    ffmpeg error: [libx264 @ 000000000030e860] 8x8 transform intra:49.4% inter:92.1%
    ffmpeg error: [libx264 @ 000000000030e860] coded y,uvDC,uvAC intra: 74.2% 73.7% 69.0% inter: 0.0% 0.2% 0.0%
    ffmpeg error: [libx264 @ 000000000030e860] i16 v,h,dc,p: 97%  0%  2%  1%
    ffmpeg error: [libx264 @ 000000000030e860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 19% 15%  7%  9%  7% 10%  7% 13%
    ffmpeg error: [libx264 @ 000000000030e860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 21%  8%  8% 11%  9% 12%  7% 13%
    ffmpeg error: [libx264 @ 000000000030e860] i8c dc,h,v,p: 55% 19% 16% 10%
    ffmpeg error: [libx264 @ 000000000030e860] Weighted P-Frames: Y:0.0% UV:0.0%
    ffmpeg error: [libx264 @ 000000000030e860] ref P L0: 95.4%  0.6%  3.1%  0.9%
    ffmpeg error: [libx264 @ 000000000030e860] ref B L1: 98.8%  1.2%
    ffmpeg error: [libx264 @ 000000000030e860] kb/s:1127.01
    ffmpeg error: [aac @ 0000000002ecc880] Qavg: 541.237
    ffmpeg error:
    done!
  • ffmpeg conversion using libx264 looks terrible - interlaced

    17 juin 2016, par justin

    I’m in the process of converting some files from my set-top box (.ASF) format to something more portable that will work with plex and roku more readily. In doing so I’m using ffmpeg, but having unsatisfying results. Whereas the original doesn’t have ANY notable interlacing defects, the converted file does. I think it has something to do with the libx264 converter because of the following experiment :

    Running this command :

    ffmpeg -i file.asf -vcodec copy -acodec copy -bsf:a aac_adtstoasc -ss 150 -t 15 short.mp4

    ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with Apple LLVM version 7.3.0 (clang-703.0.29)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda
     libavutil      55. 17.103 / 55. 17.103
     libavcodec     57. 24.102 / 57. 24.102
     libavformat    57. 25.100 / 57. 25.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 31.100 /  6. 31.100
     libavresample   3.  0.  0 /  3.  0.  0
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    [asf @ 0x7f9f84000000] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, asf, from 'file.asf':
     Metadata:
       title           : Slingbox
       artist          : Sling Media
       comment         : test
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: h264 (High) (h264 / 0x34363268), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 59.94 tbc
       Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 32000 Hz, stereo, fltp, 96 kb/s
       Stream #0:2: Unknown: none
    File 'short.mp4' already exists. Overwrite ? [y/N] y
    Output #0, mp4, to 'short.mp4':
     Metadata:
       title           : Slingbox
       artist          : Sling Media
       comment         : test
       encoder         : Lavf57.25.100
       Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30.30 fps, 30 tbr, 16k tbn, 1k tbc
       Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 32000 Hz, stereo, 96 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [mp4 @ 0x7f9f8388c200] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    [mp4 @ 0x7f9f8388c200] pts has no value
       Last message repeated 449 times
    frame=  450 fps=0.0 q=-1.0 Lsize=    9002kB time=00:00:15.02 bitrate=4907.9kbits/s speed=92.1x    
    video:8817kB audio:173kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.125406%

    Which produces a file which has no interlacing artifact and appears to be same exact file size as the original (if run without the -ss and -t commands).

    But running this command (without any options) :

    ffmpeg -i test.asf -ss 150 -t 15 short2.mp4

    ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with Apple LLVM version 7.3.0 (clang-703.0.29)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-vda
     libavutil      55. 17.103 / 55. 17.103
     libavcodec     57. 24.102 / 57. 24.102
     libavformat    57. 25.100 / 57. 25.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 31.100 /  6. 31.100
     libavresample   3.  0.  0 /  3.  0.  0
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    [asf @ 0x7fec32801400] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, asf, from 'test.asf':
     Metadata:
       title           : Slingbox
       artist          : Sling Media
       comment         : test
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: h264 (High) (h264 / 0x34363268), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn, 59.94 tbc
       Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 32000 Hz, stereo, fltp, 96 kb/s
       Stream #0:2: Unknown: none
    [libx264 @ 0x7fec32102800] using SAR=1/1
    [libx264 @ 0x7fec32102800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7fec32102800] profile High, level 4.0
    [libx264 @ 0x7fec32102800] 264 - core 148 r2668 fd2c324 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'short2.mp4':
     Metadata:
       title           : Slingbox
       artist          : Sling Media
       comment         : test
       encoder         : Lavf57.25.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.24.102 libx264
       Side data:
         unknown side data type 10 (24 bytes)
       Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 32000 Hz, stereo, fltp, 128 kb/s
       Metadata:
         encoder         : Lavc57.24.102 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=  450 fps= 20 q=-1.0 Lsize=    6732kB time=00:00:15.00 bitrate=3674.9kbits/s speed=0.657x    
    video:6481kB audio:240kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.168370%
    [libx264 @ 0x7fec32102800] frame I:12    Avg QP:18.85  size: 39804
    [libx264 @ 0x7fec32102800] frame P:291   Avg QP:21.40  size: 17543
    [libx264 @ 0x7fec32102800] frame B:147   Avg QP:22.61  size:  7167
    [libx264 @ 0x7fec32102800] consecutive B-frames: 42.9% 36.9% 11.3%  8.9%
    [libx264 @ 0x7fec32102800] mb I  I16..4: 43.2% 52.0%  4.8%
    [libx264 @ 0x7fec32102800] mb P  I16..4: 11.9% 16.0%  1.0%  P16..4: 30.2%  3.0%  1.7%  0.0%  0.0%    skip:36.2%
    [libx264 @ 0x7fec32102800] mb B  I16..4:  0.6%  0.9%  0.1%  B16..8: 25.7%  1.4%  0.2%  direct: 4.6%  skip:66.6%  L0:49.0% L1:49.4% BI: 1.6%
    [libx264 @ 0x7fec32102800] 8x8 transform intra:55.1% inter:92.0%
    [libx264 @ 0x7fec32102800] coded y,uvDC,uvAC intra: 22.5% 38.6% 6.6% inter: 6.5% 17.3% 0.5%
    [libx264 @ 0x7fec32102800] i16 v,h,dc,p: 28% 47%  8% 17%
    [libx264 @ 0x7fec32102800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 15% 42%  1%  1%  2%  1%  2%  1%
    [libx264 @ 0x7fec32102800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 78%  6%  1%  1%  1%  1%  1%  1%
    [libx264 @ 0x7fec32102800] i8c dc,h,v,p: 59% 19% 19%  3%
    [libx264 @ 0x7fec32102800] Weighted P-Frames: Y:14.4% UV:3.8%
    [libx264 @ 0x7fec32102800] ref P L0: 65.5%  6.6% 19.0%  8.4%  0.4%
    [libx264 @ 0x7fec32102800] ref B L0: 89.6%  8.9%  1.5%
    [libx264 @ 0x7fec32102800] ref B L1: 98.6%  1.4%
    [libx264 @ 0x7fec32102800] kb/s:3539.34
    [aac @ 0x7fec32103a00] Qavg: 573.580

    Produces a file which has quite a bit of interlacing defect when playing on my HD projector thru Roku via Plex (direct play enabled, apparently no transcoding).

    still frame from second transcode showing visual defect

    Lest I be overly picky, I engaged my wife in this test, showing her the two files and she agreed that the one that used libx264 was significantly worse and unwatchable. Can’t figure out how to shrink this file down without causing these interlacing defects — it happens even when I don’t try to shrink it ! Any thoughts ?

    Video files :

    https://dl.dropboxusercontent.com/u/23091/m1/short.mp4
    https://dl.dropboxusercontent.com/u/23091/m1/short2.mp4

    Update : Additionally, I tried a few settings to generate a MPEG4 (.AVI) file and had similar lack of success. Similar interlacing defects.

  • FFMPEG not enough data (x y), trying to decode anyway

    7 juin 2016, par Forest J. Handford

    I’m trying to make videos of Direct3D games using a C# app. For non-Direct3D games I stream images from Graphics.CopyFromScreen which works. When I copy the screen from Direct3D and stream it to FFMPEG I get :

    [bmp @ 00000276b0b9c280] not enough data (5070 < 129654), trying to
    decode anyway

    An MP4 file is created, but it is always 0 bytes.

    To get screenshots from Direct3D, I am using Justin Stenning’s Direct3DHook. This produces images MUCH bigger than when I get images from Graphics.CopyFromScreen (8 MB vs 136 KB). I’ve tried increasing the buffer (-bufsize) but the number on the left of the error is not impacted.

    I’ve tried resizing the image to 1/6th the original. That reduces the number on the right, but does not eliminate it. Even when the number on the right is close to what I have for Graphics.CopyFromScreen I get an error. Here is a sample of the current code :

    using System;
    using System.Diagnostics;
    using System.Threading;
    using System.Drawing;
    using Capture.Hook;
    using Capture.Interface;
    using Capture;
    using System.IO;

    namespace GameRecord
    {
       public class Video
       {
           private const int VID_FRAME_FPS = 8;
           private const int SIZE_MODIFIER = 6;
           private const double FRAMES_PER_MS = VID_FRAME_FPS * 0.001;
           private const int SLEEP_INTERVAL = 2;
           private const int CONSTANT_RATE_FACTOR = 18; // Lower crf = Higher Quality https://trac.ffmpeg.org/wiki/Encode/H.264
           private Image image;
           private Capture captureScreen;
           private int processId = 0;
           private Process process;
           private CaptureProcess captureProcess;
           private Process launchingFFMPEG;
           private string arg;
           private int frame = 0;
           private Size? resize = null;


           /// <summary>
           /// Generates the Videos by gathering frames and processing via FFMPEG.
           /// </summary>
           public void RecordScreenTillGameEnd(string exe, OutputDirectory outputDirectory, CustomMessageBox alertBox, Thread workerThread)
           {
               AttachProcess(exe);
               RequestD3DScreenShot();
               while (image == null) ;
               Logger.log.Info("Launching FFMPEG ....");
               resize = new Size(image.Width / SIZE_MODIFIER, image.Height / SIZE_MODIFIER);
               // H.264 can let us do 8 FPS in high res . . . but must be licensed for commercial use.
               arg = "-f image2pipe -framerate " + VID_FRAME_FPS + " -i pipe:.bmp -pix_fmt yuv420p -crf " +
                   CONSTANT_RATE_FACTOR + " -preset ultrafast -s " + resize.Value.Width + "x" +
                   resize.Value.Height + " -vcodec libx264 -bufsize 30000k -y \"" +
                   outputDirectory.pathToVideo + "\"";

               launchingFFMPEG = new Process
               {
                   StartInfo = new ProcessStartInfo
                   {
                       FileName = "ffmpeg",
                       Arguments = arg,
                       UseShellExecute = false,
                       CreateNoWindow = true,
                       RedirectStandardInput = true,
                       RedirectStandardError = true
                   }
               };
               launchingFFMPEG.Start();

               Stopwatch stopWatch = Stopwatch.StartNew(); //creates and start the instance of Stopwatch

               do
               {
                   Thread.Sleep(SLEEP_INTERVAL);
               } while (workerThread.IsAlive);

               Logger.log.Info("Total frames: " + frame + " Expected frames: " + (ExpectedFrames(stopWatch.ElapsedMilliseconds) - 1));

               launchingFFMPEG.StandardInput.Close();

    #if DEBUG
               string line;
               while ((line = launchingFFMPEG.StandardError.ReadLine()) != null)
               {
                   Logger.log.Debug(line);
               }
    #endif
               launchingFFMPEG.Close();
               alertBox.Show();
           }

           void RequestD3DScreenShot()
           {
               captureProcess.CaptureInterface.BeginGetScreenshot(new Rectangle(0, 0, 0, 0), new TimeSpan(0, 0, 2), Callback, resize, (ImageFormat)Enum.Parse(typeof(ImageFormat), "Bitmap"));
           }

           private void AttachProcess(string exe)
           {
               Thread.Sleep(300);
               Process[] processes = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(exe));
               foreach (Process currProcess in processes)
               {
                   // Simply attach to the first one found.

                   // If the process doesn't have a mainwindowhandle yet, skip it (we need to be able to get the hwnd to set foreground etc)
                   if (currProcess.MainWindowHandle == IntPtr.Zero)
                   {
                       continue;
                   }

                   // Skip if the process is already hooked (and we want to hook multiple applications)
                   if (HookManager.IsHooked(currProcess.Id))
                   {
                       continue;
                   }

                   Direct3DVersion direct3DVersion = Direct3DVersion.AutoDetect;

                   CaptureConfig cc = new CaptureConfig()
                   {
                       Direct3DVersion = direct3DVersion,
                       ShowOverlay = false
                   };

                   processId = currProcess.Id;
                   process = currProcess;

                   var captureInterface = new CaptureInterface();
                   captureInterface.RemoteMessage += new MessageReceivedEvent(CaptureInterface_RemoteMessage);
                   captureProcess = new CaptureProcess(process, cc, captureInterface);

                   break;
               }
               Thread.Sleep(10);

               if (captureProcess == null)
               {
                   ShowUser.Exception("No executable found matching: '" + exe + "'");
               }
           }

           /// <summary>
           /// The callback for when the screenshot has been taken
           /// </summary>
           ///
           ///
           ///
           void Callback(IAsyncResult result)
           {
               using (Screenshot screenshot = captureProcess.CaptureInterface.EndGetScreenshot(result))
               if (screenshot != null &amp;&amp; screenshot.Data != null &amp;&amp; arg != null)
               {
                   if (image != null)
                   {
                       image.Dispose();
                   }

                   image = screenshot.ToBitmap();
                   // image.Save("D3DImageTest.bmp");
                   image.Save(launchingFFMPEG.StandardInput.BaseStream, System.Drawing.Imaging.ImageFormat.Bmp);
                   launchingFFMPEG.StandardInput.Flush();
                   frame++;
               }

               if (frame &lt; 5)
               {
                   Thread t = new Thread(new ThreadStart(RequestD3DScreenShot));
                   t.Start();
               }
               else
               {
                   Logger.log.Info("Done getting shots from D3D.");
               }
           }

           /// <summary>
           /// Display messages from the target process
           /// </summary>
           ///
           private void CaptureInterface_RemoteMessage(MessageReceivedEventArgs message)
           {
               Logger.log.Info(message);
           }
       }
    }

    When I search the internet for the error all I get is the FFMPEG source code, which has not proven to be illuminating. I have been able to save the image directly to disk, which makes me feel like it is not an issue with disposing the data. I have also tried only grabbing one frame, but that produces the same error, which suggests to me it is not a threading issue.

    Here is the full sample of stderr :

    2016-06-02 18:29:38,046 === ffmpeg version N-79143-g8ff0f6a Copyright (c) 2000-2016 the FFmpeg developers

    2016-06-02 18:29:38,047 ===   built with gcc 5.3.0 (GCC)

    2016-06-02 18:29:38,048 ===   configuration: --enable-gpl
    --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib

    2016-06-02 18:29:38,062 ===   libavutil      55. 19.100 / 55. 19.100

    2016-06-02 18:29:38,063 ===   libavcodec     57. 30.100 / 57. 30.100

    2016-06-02 18:29:38,064 ===   libavformat    57. 29.101 / 57. 29.101

    2016-06-02 18:29:38,064 ===   libavdevice    57.  0.101 / 57.  0.101

    2016-06-02 18:29:38,065 ===   libavfilter     6. 40.102 /  6. 40.102

    2016-06-02 18:29:38,066 ===   libswscale      4.  0.100 /  4.  0.100

    2016-06-02 18:29:38,067 ===   libswresample   2.  0.101 /  2.  0.101

    2016-06-02 18:29:38,068 ===   libpostproc    54.  0.100 / 54.  0.100

    2016-06-02 18:29:38,068 === [bmp @ 000002cd7e5cc280] not enough data (13070 &lt; 8294454), trying to decode anyway

    2016-06-02 18:29:38,069 === [bmp @ 000002cd7e5cc280] not enough data (13016 &lt; 8294400)

    2016-06-02 18:29:38,069 === Input #0, image2pipe, from 'pipe:.bmp':

    2016-06-02 18:29:38,262 ===   Duration: N/A, bitrate: N/A

    2016-06-02 18:29:38,262 ===     Stream #0:0: Video: bmp, bgra, 1920x1080, 8 tbr, 8 tbn, 8 tbc

    2016-06-02 18:29:38,263 === [libx264 @ 000002cd7e5d59a0] VBV bufsize set but maxrate unspecified, ignored

    2016-06-02 18:29:38,264 === [libx264 @ 000002cd7e5d59a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2

    2016-06-02 18:29:38,265 === [libx264 @ 000002cd7e5d59a0] profile Constrained Baseline, level 1.1

    2016-06-02 18:29:38,266 === [libx264 @ 000002cd7e5d59a0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=8 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0

    2016-06-02 18:29:38,463 === Output #0, mp4, to 'C:\Users\fores\AppData\Roaming\Affectiva\n_Artifacts_20160602_182857\GameplayVidOut.mp4':

    2016-06-02 18:29:38,464 ===   Metadata:

    2016-06-02 18:29:38,465 ===     encoder         : Lavf57.29.101

    2016-06-02 18:29:38,469 ===     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x180, q=-1--1, 8 fps, 16384 tbn, 8 tbc

    2016-06-02 18:29:38,470 ===     Metadata:

    2016-06-02 18:29:38,472 ===       encoder         : Lavc57.30.100 libx264

    2016-06-02 18:29:38,474 ===     Side data:

    2016-06-02 18:29:38,475 ===       cpb: bitrate max/min/avg: 0/0/0 buffer size: 30000000 vbv_delay: -1

    2016-06-02 18:29:38,476 === Stream mapping:

    2016-06-02 18:29:38,477 ===   Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))

    2016-06-02 18:29:38,480 === [bmp @ 000002cd7e5cc9a0] not enough data (13070 &lt; 8294454), trying to decode anyway

    2016-06-02 18:29:38,662 === [bmp @ 000002cd7e5cc9a0] not enough data (13016 &lt; 8294400)

    2016-06-02 18:29:38,662 === Error while decoding stream #0:0: Invalid data found when processing input

    2016-06-02 18:29:38,663 === frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    

    2016-06-02 18:29:38,663 === video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

    2016-06-02 18:29:38,664 === Conversion failed!

    In memory, the current image is 320 pixels wide and 180 pixels long. The pixel format is Format32bppRgb. The horizontal and vertical resolutions seem odd, they are both 96.01199. When filed to disk here is ffprobe output for the file :

    ffprobe version N-79143-g8ff0f6a Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.0 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
     libavutil      55. 19.100 / 55. 19.100
     libavcodec     57. 30.100 / 57. 30.100
     libavformat    57. 29.101 / 57. 29.101
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 40.102 /  6. 40.102
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, png_pipe, from 'C:\Users\fores\git\game-playtest-tool\GamePlayTest\bin\x64\Debug\D3DFromCapture.bmp':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 3779:3779 DAR 16:9], 25 tbr, 25 tbn, 25 tbc

    Here is a PNG version of an example screenshot from the current code (playing Portal 2) :
    Portal 2 Screenshot

    Any ideas would be greatly appreciated. My current workaround is to save the files to the HDD and compile the video after gameplay, but it’s a far less performant option. Thank you !