Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (48)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (9084)

  • How to calculate vmaf score of multi-resolution webm using ffmpeg ?

    13 juillet 2022, par will

    I’m trying to calculate the vmaf of two videos, one is avi(rawvideo(I420), yuv420p), the other is webm(vp8, yuv420p). I uploaded test video and vmaf log here.

    


    But I found that if it’s a multi-resolution webm, the scores obtained with and without fps filter are quite different. Without fps filter the vmaf score is 34.670390, with fps filter the vmaf score is 56.339923.

    


    If it‘s a single resolution webm, there is no significant difference between the scores obtained with and without fps filter. Without fps filter the vmaf score is 65.527304, with fps filter the vmaf score is 65.480217.

    


    I use these commands.

    


    without fps filter

    


    ffmpeg \
    -r 15 -i reference.avi \
    -r 15 -i distorted.webm \
    -lavfi "[0:v]setpts=PTS-STARTPTS[reference]; \
            [1:v]scale=1920:1080:flags=bicubic,setpts=PTS-STARTPTS[distorted]; \
            [distorted][reference]libvmaf=log_fmt=json:log_path=vmaf_without_fps.log:model_path=vmaf_v0.6.1.json:n_threads=10:ssim=1:psnr=1" \
    -f null -


    


    ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, avi, from 'reference.avi':
  Metadata:
    software        : Lavf58.76.100
  Duration: 00:00:26.13, start: 0.000000, bitrate: 373260 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 374202 kb/s, 15 fps, 15 tbr, 15 tbn, 15 tbc
Input #1, matroska,webm, from 'distorted.webm':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  Stream #1:1(eng): Video: vp8, yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 1k tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
Stream mapping:
  Stream #0:0 (rawvideo) -> setpts (graph 0)
  Stream #1:1 (vp8) -> scale (graph 0)
  libvmaf (graph 0) -> Stream #0:0 (wrapped_avframe)
  Stream #1:0 -> #0:1 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
libvmaf INFO `compute_vmaf()` is deprecated and will be removed in a future libvmaf version
Output #0, null, to 'pipe:':
  Metadata:
    software        : Lavf58.76.100
    encoder         : Lavf58.76.100
  Stream #0:0: Video: wrapped_avframe, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 15 fps, 15 tbn (default)
    Metadata:
      encoder         : Lavc58.134.100 wrapped_avframe
  Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      encoder         : Lavc58.134.100 pcm_s16le
[libvmaf @ 0x7feb8a606a80] VMAF score: 58.1203705.87 bitrate=N/A speed= 5.6x    
libvmaf INFO `compute_vmaf()` is deprecated and will be removed in a future libvmaf version
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 0
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 1
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 2
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 3
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 4
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 5
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 6
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 7
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 8
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 9
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 10
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 11
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 12
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 13
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 14
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 15
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 16
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 17
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 18
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 19
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 20
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 21
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 22
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 23
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 24
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 25
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 26
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 27
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 28
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 29
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 30
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 31
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 32
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 33
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 34
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 35
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 36
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 37
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 38
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 39
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 40
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 41
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 42
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 43
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 44
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 45
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 46
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 47
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 48
[null @ 0x7feb8b04da00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 49 >= 49
frame=  392 fps= 36 q=-0.0 Lsize=N/A time=00:00:28.73 bitrate=N/A speed= 2.6x    
video:205kB audio:5400kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libvmaf @ 0x7feb8c405bc0] VMAF score: 34.670390


    


    with fps filter

    


    ffmpeg \
    -r 15 -i reference.avi \
    -r 15 -i distorted.webm \
    -lavfi "[0:v]setpts=PTS-STARTPTS[reference]; \
            [1:v]fps=fps=15,scale=1920:1080:flags=bicubic,setpts=PTS-STARTPTS[distorted]; \
            [distorted][reference]libvmaf=log_fmt=json:log_path=vmaf_with_fps.log:model_path=vmaf_v0.6.1.json:n_threads=10:ssim=1:psnr=1" \
    -f null -


    


    ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, avi, from 'reference.avi':
  Metadata:
    software        : Lavf58.76.100
  Duration: 00:00:26.13, start: 0.000000, bitrate: 373260 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 374202 kb/s, 15 fps, 15 tbr, 15 tbn, 15 tbc
Input #1, matroska,webm, from 'distorted.webm':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  Stream #1:1(eng): Video: vp8, yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 1k tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
Stream mapping:
  Stream #0:0 (rawvideo) -> setpts (graph 0)
  Stream #1:1 (vp8) -> fps (graph 0)
  libvmaf (graph 0) -> Stream #0:0 (wrapped_avframe)
  Stream #1:0 -> #0:1 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
libvmaf INFO `compute_vmaf()` is deprecated and will be removed in a future libvmaf version
Output #0, null, to 'pipe:':
  Metadata:
    software        : Lavf58.76.100
    encoder         : Lavf58.76.100
  Stream #0:0: Video: wrapped_avframe, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 15 fps, 15 tbn (default)
    Metadata:
      encoder         : Lavc58.134.100 wrapped_avframe
  Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      encoder         : Lavc58.134.100 pcm_s16le
[libvmaf @ 0x7fdeab00bac0] VMAF score: 58.3160815.27 bitrate=N/A speed=5.08x    
libvmaf INFO `compute_vmaf()` is deprecated and will be removed in a future libvmaf version
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 0
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 1
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 2
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 3
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 4
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 5
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 6
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 7
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 8
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 9
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 10
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 11
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 12
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 13
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 14
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 15
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 16
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 17
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 18
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 19
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 20
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 21
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 22
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 23
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 24
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 25
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 26
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 27
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 28
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 29
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 30
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 31
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 32
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 33
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 34
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 35
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 36
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 37
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 38
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 39
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 40
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 41
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 42
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 43
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 44
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 45
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 46
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 47
[null @ 0x7fdeab84ba00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 48 >= 48
frame=  391 fps= 36 q=-0.0 Lsize=N/A time=00:00:28.73 bitrate=N/A speed=2.62x    
video:205kB audio:5400kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libvmaf @ 0x7fdea9f34a00] VMAF score: 56.339923


    


    I'm curious about what causes such a difference ? And how to calculate vmaf score of multi-resolution webm correctly ?

    


  • Revision 2de18d1fd2 : Super resolution mode (+CONFIG_SR_MODE) CONFIG_SR_MODE=1, enable SR mode USE_PO

    12 août 2015, par Shunyao Li

    Changed Paths :
     Modify /configure


     Modify /vp9/common/vp9_blockd.h


     Modify /vp9/common/vp9_entropymode.c


     Modify /vp9/common/vp9_entropymode.h


     Modify /vp9/common/vp9_idct.c


     Modify /vp9/common/vp9_idct.h


     Modify /vp9/common/vp9_pred_common.h


     Modify /vp9/common/vp9_rtcd_defs.pl


     Add /vp9/common/vp9_sr_txfm.c


     Add /vp9/common/vp9_sr_txfm.h


     Modify /vp9/decoder/vp9_decodeframe.c


     Modify /vp9/decoder/vp9_decodemv.c


     Modify /vp9/encoder/vp9_bitstream.c


     Modify /vp9/encoder/vp9_block.h


     Modify /vp9/encoder/vp9_encodeframe.c


     Modify /vp9/encoder/vp9_encodemb.c


     Modify /vp9/encoder/vp9_encodemb.h


     Modify /vp9/encoder/vp9_encoder.c


     Modify /vp9/encoder/vp9_firstpass.c


     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/encoder/vp9_tokenize.c


     Modify /vp9/vp9_common.mk



    Super resolution mode (+CONFIG_SR_MODE)

    CONFIG_SR_MODE=1, enable SR mode
    USE_POST_F=1, enable SR post filter
    SR_USE_MULTI_F=1, enable SR post filter family
    Not compatible with other experiments yet

    Change-Id : I116f1d898cc2ff7dd114d7379664304907afe0ec

  • Screenrecorder application output video resolution issues [closed]

    23 juin 2022, par JessieK

    Using Github code for ScreenRecorder on Linux
Everything works fine, besides the resolution of output video.
Tried to play with setting, quality has significantly improved, but still no way to change resolution.
I need to get output video with the same size as input video

    


    using namespace std;

    /* initialize the resources*/
    ScreenRecorder::ScreenRecorder()
    {
    
        av_register_all();
        avcodec_register_all();
        avdevice_register_all();
        cout<<"\nall required functions are registered successfully";
    }
    
    /* uninitialize the resources */
    ScreenRecorder::~ScreenRecorder()
    {
    
        avformat_close_input(&pAVFormatContext);
        if( !pAVFormatContext )
        {
            cout<<"\nfile closed sucessfully";
        }
        else
        {
            cout<<"\nunable to close the file";
            exit(1);
        }
    
        avformat_free_context(pAVFormatContext);
        if( !pAVFormatContext )
        {
            cout<<"\navformat free successfully";
        }
        else
        {
            cout<<"\nunable to free avformat context";
            exit(1);
        }
    
    }
    
    /* function to capture and store data in frames by allocating required memory and auto deallocating the memory.   */
    int ScreenRecorder::CaptureVideoFrames()
    {
        int flag;
        int frameFinished;//when you decode a single packet, you still don't have information enough to have a frame [depending on the type of codec, some of them //you do], when you decode a GROUP of packets that represents a frame, then you have a picture! that's why frameFinished will let //you know you decoded enough to have a frame.
    
        int frame_index = 0;
        value = 0;
    
        pAVPacket = (AVPacket *)av_malloc(sizeof(AVPacket));
        av_init_packet(pAVPacket);
    
        pAVFrame = av_frame_alloc();
        if( !pAVFrame )
        {
         cout<<"\nunable to release the avframe resources";
         exit(1);
        }
    
        outFrame = av_frame_alloc();//Allocate an AVFrame and set its fields to default values.
        if( !outFrame )
        {
         cout<<"\nunable to release the avframe resources for outframe";
         exit(1);
        }
    
        int video_outbuf_size;
        int nbytes = av_image_get_buffer_size(outAVCodecContext->pix_fmt,outAVCodecContext->width,outAVCodecContext->height,32);
        uint8_t *video_outbuf = (uint8_t*)av_malloc(nbytes);
        if( video_outbuf == NULL )
        {
            cout<<"\nunable to allocate memory";
            exit(1);
        }
    
        // Setup the data pointers and linesizes based on the specified image parameters and the provided array.
        value = av_image_fill_arrays( outFrame->data, outFrame->linesize, video_outbuf , AV_PIX_FMT_YUV420P, outAVCodecContext->width,outAVCodecContext->height,1 ); // returns : the size in bytes required for src
        if(value < 0)
        {
            cout<<"\nerror in filling image array";
        }
    
        SwsContext* swsCtx_ ;
    
        // Allocate and return swsContext.
        // a pointer to an allocated context, or NULL in case of error
        // Deprecated : Use sws_getCachedContext() instead.
        swsCtx_ = sws_getContext(pAVCodecContext->width,
                            pAVCodecContext->height,
                            pAVCodecContext->pix_fmt,
                            outAVCodecContext->width,
                    outAVCodecContext->height,
                            outAVCodecContext->pix_fmt,
                            SWS_BICUBIC, NULL, NULL, NULL);
    
    
    int ii = 0;
    int no_frames = 100;
    cout<<"\nenter No. of frames to capture : ";
    cin>>no_frames;
    
        AVPacket outPacket;
        int j = 0;
    
        int got_picture;
    
        while( av_read_frame( pAVFormatContext , pAVPacket ) >= 0 )
        {
        if( ii++ == no_frames )break;
            if(pAVPacket->stream_index == VideoStreamIndx)
            {
                value = avcodec_decode_video2( pAVCodecContext , pAVFrame , &frameFinished , pAVPacket );
                if( value < 0)
                {
                    cout<<"unable to decode video";
                }
    
                if(frameFinished)// Frame successfully decoded :)
                {
                    sws_scale(swsCtx_, pAVFrame->data, pAVFrame->linesize,0, pAVCodecContext->height, outFrame->data,outFrame->linesize);
                    av_init_packet(&outPacket);
                    outPacket.data = NULL;    // packet data will be allocated by the encoder
                    outPacket.size = 0;
    
                    avcodec_encode_video2(outAVCodecContext , &outPacket ,outFrame , &got_picture);
    
                    if(got_picture)
                    {
                        if(outPacket.pts != AV_NOPTS_VALUE)
                            outPacket.pts = av_rescale_q(outPacket.pts, video_st->codec->time_base, video_st->time_base);
                        if(outPacket.dts != AV_NOPTS_VALUE)
                            outPacket.dts = av_rescale_q(outPacket.dts, video_st->codec->time_base, video_st->time_base);
                    
                        printf("Write frame %3d (size= %2d)\n", j++, outPacket.size/1000);
                        if(av_write_frame(outAVFormatContext , &outPacket) != 0)
                        {
                            cout<<"\nerror in writing video frame";
                        }
    
                    av_packet_unref(&outPacket);
                    } // got_picture
    
                av_packet_unref(&outPacket);
                } // frameFinished
    
            }
        }// End of while-loop


    


    One part of two parts is above...Actually original app seem to record video of same size as does my application, but still it has not any use

    



    


    Second part of the code

    


    av_free(video_outbuf);

}

/* establishing the connection between camera or screen through its respective folder */
int ScreenRecorder::openCamera()
{

    value = 0;
    options = NULL;
    pAVFormatContext = NULL;

    pAVFormatContext = avformat_alloc_context();//Allocate an AVFormatContext.
/*

X11 video input device.
To enable this input device during configuration you need libxcb installed on your system. It will be automatically detected during configuration.
This device allows one to capture a region of an X11 display. 
refer : https://www.ffmpeg.org/ffmpeg-devices.html#x11grab
*/
    /* current below is for screen recording. to connect with camera use v4l2 as a input parameter for av_find_input_format */ 
    pAVInputFormat = av_find_input_format("x11grab");
    value = avformat_open_input(&pAVFormatContext, ":0.0+10,250", pAVInputFormat, NULL);
    if(value != 0)
    {
       cout<<"\nerror in opening input device";
       exit(1);
    }

    /* set frame per second */
    value = av_dict_set( &options,"framerate","30",0 );
    if(value < 0)
    {
      cout<<"\nerror in setting dictionary value";
       exit(1);
    }

    value = av_dict_set( &options, "preset", "medium", 0 );
    if(value < 0)
    {
      cout<<"\nerror in setting preset values";
      exit(1);
    }

//  value = avformat_find_stream_info(pAVFormatContext,NULL);
    if(value < 0)
    {
      cout<<"\nunable to find the stream information";
      exit(1);
    }

    VideoStreamIndx = -1;

    /* find the first video stream index . Also there is an API available to do the below operations */
    for(int i = 0; i < pAVFormatContext->nb_streams; i++ ) // find video stream posistion/index.
    {
      if( pAVFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO )
      {
         VideoStreamIndx = i;
         break;
      }

    } 

    if( VideoStreamIndx == -1)
    {
      cout<<"\nunable to find the video stream index. (-1)";
      exit(1);
    }

    // assign pAVFormatContext to VideoStreamIndx
    pAVCodecContext = pAVFormatContext->streams[VideoStreamIndx]->codec;

    pAVCodec = avcodec_find_decoder(pAVCodecContext->codec_id);
    if( pAVCodec == NULL )
    {
      cout<<"\nunable to find the decoder";
      exit(1);
    }

    value = avcodec_open2(pAVCodecContext , pAVCodec , NULL);//Initialize the AVCodecContext to use the given AVCodec.
    if( value < 0 )
    {
      cout<<"\nunable to open the av codec";
      exit(1);
    }
}

/* initialize the video output file and its properties  */
int ScreenRecorder::init_outputfile()
{
    outAVFormatContext = NULL;
    value = 0;
    output_file = "../media/output.mp4";

    avformat_alloc_output_context2(&outAVFormatContext, NULL, NULL, output_file);
    if (!outAVFormatContext)
    {
        cout<<"\nerror in allocating av format output context";
        exit(1);
    }

/* Returns the output format in the list of registered output formats which best matches the provided parameters, or returns NULL if there is no match. */
    output_format = av_guess_format(NULL, output_file ,NULL);
    if( !output_format )
    {
     cout<<"\nerror in guessing the video format. try with correct format";
     exit(1);
    }

    video_st = avformat_new_stream(outAVFormatContext ,NULL);
    if( !video_st )
    {
        cout<<"\nerror in creating a av format new stream";
        exit(1);
    }

    outAVCodecContext = avcodec_alloc_context3(outAVCodec);
    if( !outAVCodecContext )
    {
        cout<<"\nerror in allocating the codec contexts";
        exit(1);
    }

    /* set property of the video file */
    outAVCodecContext = video_st->codec;
    outAVCodecContext->codec_id = AV_CODEC_ID_MPEG4;// AV_CODEC_ID_MPEG4; // AV_CODEC_ID_H264 // AV_CODEC_ID_MPEG1VIDEO
    outAVCodecContext->codec_type = AVMEDIA_TYPE_VIDEO;
    outAVCodecContext->pix_fmt  = AV_PIX_FMT_YUV420P;
    outAVCodecContext->bit_rate = 2500000; // 2500000
    outAVCodecContext->width = 1920;
    outAVCodecContext->height = 1080;
    outAVCodecContext->gop_size = 3;
    outAVCodecContext->max_b_frames = 2;
    outAVCodecContext->time_base.num = 1;
    outAVCodecContext->time_base.den = 30; // 15fps

    {
     av_opt_set(outAVCodecContext->priv_data, "preset", "slow", 0);
    }

    outAVCodec = avcodec_find_encoder(AV_CODEC_ID_MPEG4);
    if( !outAVCodec )
    {
     cout<<"\nerror in finding the av codecs. try again with correct codec";
    exit(1);
    }

    /* Some container formats (like MP4) require global headers to be present
       Mark the encoder so that it behaves accordingly. */

    if ( outAVFormatContext->oformat->flags & AVFMT_GLOBALHEADER)
    {
        outAVCodecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
    }

    value = avcodec_open2(outAVCodecContext, outAVCodec, NULL);
    if( value < 0)
    {
        cout<<"\nerror in opening the avcodec";
        exit(1);
    }

    /* create empty video file */
    if ( !(outAVFormatContext->flags & AVFMT_NOFILE) )
    {
     if( avio_open2(&outAVFormatContext->pb , output_file , AVIO_FLAG_WRITE ,NULL, NULL) < 0 )
     {
      cout<<"\nerror in creating the video file";
      exit(1);
     }
    }

    if(!outAVFormatContext->nb_streams)
    {
        cout<<"\noutput file dose not contain any stream";
        exit(1);
    }

    /* imp: mp4 container or some advanced container file required header information*/
    value = avformat_write_header(outAVFormatContext , &options);
    if(value < 0)
    {
        cout<<"\nerror in writing the header context";
        exit(1);
    }


    cout<<"\n\nOutput file information :\n\n";
    av_dump_format(outAVFormatContext , 0 ,output_file ,1);


    


    Github link https://github.com/abdullahfarwees/screen-recorder-ffmpeg-cpp