Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (35)

  • 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 (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (5621)

  • M2TS from FREEBOX V6 -> Subtitle issue : Unsupported codec

    2 avril 2016, par httpways

    I would like to extract subtitles of an M2TS file coming from my FREEBOX V6.

    Below the command I typed :

    $ avprobe source.m2ts
    avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers
     built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [aac @ 0x224c0c0] get_buffer() failed
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [aac @ 0x2267a80] get_buffer() failed
    [aac @ 0x224b6a0] get_buffer() failed
    [h264 @ 0x2249700] non-existing PPS referenced
    [h264 @ 0x2249700] non-existing PPS 0 referenced
    [h264 @ 0x2249700] decode_slice_header error
    [h264 @ 0x2249700] no frame!
    [mpegts @ 0x2244200] max_analyze_duration reached
    [mpegts @ 0x2244200] PES packet size mismatch
    [mpegts @ 0x2244200] PES packet size mismatch
    [mpegts @ 0x2244200] PES packet size mismatch
    [mpegts @ 0x2244200] PES packet size mismatch
    Input #0, mpegts, from 'source.m2ts':
     Duration: 00:55:00.23, start: 19624.453300, bitrate: 4608 kb/s
     Program 4106
       Stream #0.0[0x140]: Video: h264 (High), yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0.1[0x14a](fra): Audio: aac, 48000 Hz, stereo, fltp, 66 kb/s
       Stream #0.2[0x14b](qad): Audio: aac, 48000 Hz, stereo, fltp, 54 kb/s
       Stream #0.3[0x14c](qaa): Audio: aac, 48000 Hz, stereo, fltp, 65 kb/s
       Stream #0.4[0x155](fre): Subtitle: [6][0][0][0] / 0x0006
    [h264 @ 0x2249f80] Ignoring NAL unit 9 during extradata parsing
    Unsupported codec with id 94215 for input stream 4
    # avprobe output

    As you can see, I have an unsupported codec for the Subtitle stream n°4 [b]Unsupported codec with id 94215 for input stream 4[/b]

    Any idea on how to fix it ?

    Below is the mediainfo to show you more information about the file M2TS generated by the FREEBOX V6 :

    $ mediainfo source.m2ts
    General
    ID                                       : 4106 (0x100A)
    Complete name                            : source.m2ts
    Format                                   : BDAV
    Format/Info                              : Blu-ray Video
    File size                                : 1.77 GiB
    Duration                                 : 54mn 59s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 4 609 Kbps

    Video
    ID                                       : 320 (0x140)
    Menu ID                                  : 4106 (0x100A)
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Format settings, GOP                     : M=4, N=25
    Codec ID                                 : 27
    Duration                                 : 54mn 59s
    Width                                    : 1 440 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 25.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : MBAFF

    Audio #1
    ID                                       : 330 (0x14A)
    Menu ID                                  : 4106 (0x100A)
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format version                           : Version 2
    Format profile                           : HE-AAC / LC
    Muxing mode                              : ADTS
    Codec ID                                 : 15
    Duration                                 : 54mn 59s
    Bit rate mode                            : Variable
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz / 24.0 KHz
    Compression mode                         : Lossy
    Delay relative to video                  : -104ms
    Language                                 : French

    Audio #2
    ID                                       : 331 (0x14B)
    Menu ID                                  : 4106 (0x100A)
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format version                           : Version 2
    Format profile                           : HE-AAC / LC
    Muxing mode                              : ADTS
    Codec ID                                 : 15
    Duration                                 : 54mn 59s
    Bit rate mode                            : Variable
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz / 24.0 KHz
    Compression mode                         : Lossy
    Delay relative to video                  : -104ms
    Language                                 : qad

    Audio #3
    ID                                       : 332 (0x14C)
    Menu ID                                  : 4106 (0x100A)
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format version                           : Version 2
    Format profile                           : HE-AAC / LC
    Muxing mode                              : ADTS
    Codec ID                                 : 15
    Duration                                 : 54mn 59s
    Bit rate mode                            : Variable
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 48.0 KHz / 24.0 KHz
    Compression mode                         : Lossy
    Delay relative to video                  : -104ms
    Language                                 : qaa

    Text #1
    ID                                       : 341 (0x155)-100
    Menu ID                                  : 4106 (0x100A)
    Format                                   : Teletext
    Language                                 : French

    Text #2
    ID                                       : 341 (0x155)-888
    Menu ID                                  : 4106 (0x100A)
    Format                                   : Teletext Subtitle
    Language                                 : French

    Text #3
    ID                                       : 341 (0x155)-889
    Menu ID                                  : 4106 (0x100A)
    Format                                   : Teletext Subtitle
    Language                                 : French

    Menu
    ID                                       : 66 (0x42)
    Menu ID                                  : 4106 (0x100A)
    Duration                                 : 54mn 59s
    List                                     : 320 (0x140) (AVC) / 330 (0x14A) (AAC, French) / 331 (0x14B) (AAC, qad) / 332 (0x14C) (AAC, qaa) / 341 (0x155) ()
    Language                                 :  / French / qad / qaa

    As we can, I have 3 Text section which logic with the Teletext subtitle I originnaly have on my internet box...

    Thanks for any help

  • Why calling libav* library doesn't have same quality as ffmpeg command line ?

    10 mai 2016, par seaguest

    I am using the ffmpeg 3 to do the video format conversion, it works fine when I use the command line mode, but when I call the libav* library, I get a audio quality loss problem (there is a lot of noises in the audio).

    Here are the two files :

    mv.webm - original file
    mv2.mp4 converted with libarary , a lot of noises

    Here is the probe information for the mv.webm :

    $ ffprobe mv.webm
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, matroska,webm, from 'mv.webm':
     Metadata:
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 935 kb/s
       Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn (default)
       Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)

    I checked the log printed by command line mode and calling code mode, the setting looks like the same, here are the logs :

    $ ffmpeg -i mv.webm -c:a aac -c:v libx264  mv.mp4
    ffmpeg version N-79826-g64fd62d Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, matroska,webm, from 'mv.webm':
     Metadata:
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 935 kb/s
       Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn (default)
       Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    [libx264 @ 0x3e5d880] using SAR=1/1
    [libx264 @ 0x3e5d880] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x3e5d880] profile High, level 3.0
    [libx264 @ 0x3e5d880] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 lookahead_threads=1 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
    [mp4 @ 0x3e2f680] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
       Last message repeated 1 times
    Output #0, mp4, to 'mv.mp4':
     Metadata:
       encoder         : Lavf57.36.100
       Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 12800 tbn (default)
       Metadata:
         encoder         : Lavc57.39.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         encoder         : Lavc57.39.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (vp8 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (vorbis (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=  750 fps=229 q=-1.0 Lsize=    2508kB time=00:00:30.02 bitrate= 684.5kbits/s speed=9.17x
    video:2023kB audio:459kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.052857%
    [libx264 @ 0x3e5d880] frame I:11    Avg QP:15.29  size: 20395
    [libx264 @ 0x3e5d880] frame P:345   Avg QP:20.93  size:  4350
    [libx264 @ 0x3e5d880] frame B:394   Avg QP:23.55  size:   879
    [libx264 @ 0x3e5d880] consecutive B-frames: 25.2%  3.2% 33.2% 38.4%
    [libx264 @ 0x3e5d880] mb I  I16..4: 44.1% 32.5% 23.4%
    [libx264 @ 0x3e5d880] mb P  I16..4:  1.5%  3.6%  0.6%  P16..4: 28.9% 11.2%  4.7%  0.0%  0.0%    skip:49.5%
    [libx264 @ 0x3e5d880] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 27.4%  2.0%  0.4%  direct: 0.8%  skip:69.3%  L0:40.0% L1:53.3% BI: 6.7%
    [libx264 @ 0x3e5d880] 8x8 transform intra:52.6% inter:74.9%
    [libx264 @ 0x3e5d880] coded y,uvDC,uvAC intra: 57.5% 68.6% 35.9% inter: 10.6% 11.9% 2.6%
    [libx264 @ 0x3e5d880] i16 v,h,dc,p: 36% 42%  7% 15%
    [libx264 @ 0x3e5d880] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 23% 15% 6%  7%  7% 10%  7% 10%
    [libx264 @ 0x3e5d880] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 27% 14% 6%  8%  7%  7%  6%  6%
    [libx264 @ 0x3e5d880] i8c dc,h,v,p: 46% 34% 11%  9%
    [libx264 @ 0x3e5d880] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x3e5d880] ref P L0: 63.9% 20.8% 11.2%  4.1%
    [libx264 @ 0x3e5d880] ref B L0: 93.1%  6.1%  0.8%
    [libx264 @ 0x3e5d880] ref B L1: 95.8%  4.2%
    [libx264 @ 0x3e5d880] kb/s:552.32
    [aac @ 0x3e5ec00] Qavg: 3030.804


    $ ffprobe mv.mp4
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mv.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.36.100
     Duration: 00:00:30.01, start: 0.000000, bitrate: 684 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 552 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    For the calling code mode :

    $ go run transcode.go mv.webm mv1.mp4
    # github.com/3d0c/gmf
    ../packet.go: In function ‘_cgo_3c42eeb63b1e_Cfunc_avcodec_decode_audio4’:
    ../packet.go:87:2: warning: ‘avcodec_decode_audio4’ is deprecated [-Wdeprecated-declarations]
    func (this *Packet) decode(cc *CodecCtx, frame *Frame) (*Frame, bool, int, error) {
     ^
    In file included from ../packet.go:7:0:
    /home/seaguest/ffmpeg_build/include/libavcodec/avcodec.h:4685:5: note: declared here
    int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
        ^
    ../packet.go: In function ‘_cgo_3c42eeb63b1e_Cfunc_avcodec_decode_video2’:
    ../packet.go:104:2: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
      }
     ^
    In file included from ../packet.go:7:0:
    /home/seaguest/ffmpeg_build/include/libavcodec/avcodec.h:4734:5: note: declared here
    int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
        ^
    [libx264 @ 0x2d82400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x2d82400] profile High, level 3.0
    [libx264 @ 0x2d82400] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 lookahead_threads=1 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
    [mp4 @ 0x2d480c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.



    $ ffprobe mv1.mp4
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mv1.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 751 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 613 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    Checking the setting section, crf=23.0 for both (the rest are exactly the same), but the output bitrate are different (the audio for calling code mode has a lot of noises), how is that possible ?

    Why the command line mode and use libav* library mode with same setting, but have different output ?
    What should I do to call libav* library to get lossless video conversion ?

  • 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 !