Recherche avancée

Médias (91)

Autres articles (30)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

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

  • Transcoding with the GCP Transcoder API results in a time gap

    3 mars 2021, par banyan

    I've been trying GCP's Transcoder API and having trouble with the time randomly becoming shorter than specified in certain cases.

    


    The specific cases are as follows :

    


      

    1. Specifying startTimeOffset and endTimeOffset (cut off 2 seconds before and after the video)
    2. 


    3. fMP4 is used as container
    4. 


    5. input video is mp4 with screen recording on iPad Pro
    6. 


    


    For example, if I don't specify startTimeOffset and endTimeOffset, the time will not be shortened. Also, there is no problem when MPEG2-TS is specified for container. There may be a problem with the video itself, but I haven't found a clue how to set it up.

    


    I'm not sure whether this is a problem with the Transcoder API or with me.

    


    The test input video : https://gofile.io/d/DUT9rr

    


    ❯ ffprobe input.mp4
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.28)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --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-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --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-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2021-02-26T15:08:58.000000Z
  Duration: 00:02:51.15, start: 0.000000, bitrate: 551 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 246 kb/s (default)
    Metadata:
      creation_time   : 2021-02-26T15:08:58.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709/bt709/iec61966-2-1), 1920x1342, 302 kb/s, 12.39 fps, 120 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2021-02-26T15:08:58.000000Z
      handler_name    : Core Media Video
    Side data:
      displaymatrix: rotation of -180.00 degrees


    


    #!/bin/bash -eu

cat > request.json << EOF
{
  "config": {
    "inputs": [
      {
        key: "input0"
      }
    ],
    "editList": [
      {
        "key": "atom0",
        "inputs": [
          "input0"
        ],
        "startTimeOffset": "2s",
        "endTimeOffset": "169s",
      },
    ],
    "elementaryStreams": [
      {
        "videoStream": {
          "codec": "h265",
          "heightPixels": 480,
          "bitrateBps": 1200000,
          "rateControlMode": "vbr",
          "enableTwoPass": true,
          "frameRate": 30,
          "crfLevel": 31,
          "gopDuration": "3.0s",
        },
        "key": "h265-stream0"
      },
      {
        "videoStream": {
          "codec": "h265",
          "heightPixels": 720,
          "bitrateBps": 1550000,
          "rateControlMode": "vbr",
          "enableTwoPass": true,
          "frameRate": 30,
          "crfLevel": 31,
          "gopDuration": "3.0s",
        },
        "key": "h265-stream1"
      },
      {
        "videoStream": {
          "codec": "h265",
          "heightPixels": 1080,
          "bitrateBps": 2600000,
          "rateControlMode": "vbr",
          "enableTwoPass": true,
          "frameRate": 30,
          "crfLevel": 31,
          "gopDuration": "3.0s",
        },
        "key": "h265-stream2"
      },
      {
        "audioStream": {
          "codec": "aac",
          "bitrateBps": 64000,
          "channelCount": 2,
          "channelLayout": [
            "fl",
            "fr"
          ],
          "sampleRateHertz": 48000
        },
        "key": "audio-stream0"
      },
    ],
    "muxStreams": [
      {
        "key": "media-sd",
        "fileName": "media-sd.m4s",
        "container": "fmp4",
        "elementaryStreams": [
          "h265-stream0",
        ],
        "segmentSettings": {
          "individualSegments": true
        },
      },
      {
        "key": "media-hd",
        "fileName": "media-hd.m4s",
        "container": "fmp4",
        "elementaryStreams": [
          "h265-stream1",
        ],
        "segmentSettings": {
          "individualSegments": true
        },
      },
      {
        "key": "media-fhd",
        "fileName": "media-fhd.m4s",
        "container": "fmp4",
        "elementaryStreams": [
          "h265-stream2",
        ],
        "segmentSettings": {
          "individualSegments": true
        },
      },
      {
        "key": "audio-only",
        "fileName": "audio-only.m4s",
        "container": "fmp4",
        "elementaryStreams": [
          "audio-stream0"
        ],
        "segmentSettings": {
          "individualSegments": true
        },
      },
    ],
    "manifests": [
      {
        "fileName": "manifest-h265.mpd",
        "type": "DASH",
        "muxStreams": [
          "media-sd",
          "media-hd",
          "media-fhd",
          "audio-only",
        ]
      },
    ]
  }
}
EOF

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://transcoder.googleapis.com/v1beta1/projects/MY_PROJECT/locations/asia-east1/jobTemplates?jobTemplateId=test-template


    


    #!/bin/bash -eu

cat > request.json << EOF
{
  "inputUri": "gs://my-bucket/input.mp4",
  "outputUri": "gs://my-bucket/output/",
  "templateId": "test-template"
}
EOF

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://transcoder.googleapis.com/v1beta1/projects/MY_PROJECT/locations/asia-east1/jobs


    


    The following is a ffprobe of the resulting manifest file, which is 2 seconds shorter than specified. (expected : 00:02:47.00, actual : 00:02:45.00) In this case, it's a 2-second gap, but it can be 10 seconds or 30 seconds, and it varies from video to video.

    


    ❯ ffprobe manifest-h265.mpd
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.28)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --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-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --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-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, dash, from 'manifest-h265.mpd':
  Duration: 00:02:45.00, start: 0.000000, bitrate: 0 kb/s
  Program 0
    Stream #0:0: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 686x480, 112 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
    Metadata:
      variant_bitrate : 113679
      id              : 113679
    Stream #0:1: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 1030x720, 205 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
    Metadata:
      variant_bitrate : 189219
      id              : 189219
    Stream #0:2: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709/unknown/unknown), 1544x1080, 384 kb/s, 30 fps, 120 tbr, 10k tbn, 30 tbc
    Metadata:
      variant_bitrate : 358043
      id              : 358043
    Stream #0:3: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 65 kb/s
    Metadata:
      variant_bitrate : 70245
      id              : 70245


    


    The following is the time as specified for h264 + MPEG2-TS + Apple HLS.

    


    ❯ ffprobe manifest-h264.m3u8 | pbcopy
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.28)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_8 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --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-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --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-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[hls @ 0x7fe23100f200] Opening 'h264-sd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-hd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-fhd-ts.m3u8' for reading
[hls @ 0x7fe23100f200] Skip ('#EXT-X-VERSION:4')
[hls @ 0x7fe23100f200] Opening 'h264-sd0000000000.ts' for reading
[hls @ 0x7fe23100f200] Opening 'h264-hd0000000000.ts' for reading
[hls @ 0x7fe23100f200] Opening 'h264-fhd0000000000.ts' for reading
Input #0, hls, from 'manifest-h264.m3u8':
  Duration: 00:02:47.00, start: 0.000000, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 511576
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 686x480, 120 tbr, 90k tbn, 2000k tbc
    Metadata:
      variant_bitrate : 511576
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 511576
  Program 1
    Metadata:
      variant_bitrate : 793711
    Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1030x720, 120 tbr, 90k tbn, 2000k tbc
    Metadata:
      variant_bitrate : 793711
    Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 793711
  Program 2
    Metadata:
      variant_bitrate : 1305288
    Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1544x1080, 120 tbr, 90k tbn, 2000k tbc
    Metadata:
      variant_bitrate : 1305288
    Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 1305288


    


  • FFMPEG - Converting any kind of file to Mp4 compatible with IOS and Flash

    14 février 2021, par jax

    I am struggling with FFmpeg within Drupal Video Module to produce files to MP4 that is compatible with IOS and Flash Player10 and up.
I have used the following commands so far, please note that the variables starting with " !" are placeholders and will be replaces with the proper items :

    


    FFmpeg -strict experimental -y -i !videofile -pass 1 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -an !convertfile

FFmpeg -strict experimental -y -i !videofile -pass 2 -s !widthx!height -b:v 500k -threads 0 -vcodec libx264 -vf "pad=!paddingwidth:!paddingheight:!paddingleft:!paddingtop:000000" -preset slow -acodec aac -ab 128k !convertfile


    


    The above command produce an error as :

    


    error executing command for rendering preset HTML5 MP4, command #1 :

    


    nice -n 19 /usr/bin/ffmpeg/ffmpeg -y -i '80137db8c3_1334836277_int_tr_19.mp4' -s 176x100 -b:v 500k -threads 0 -vcodec libx264 -preset slow -acodec aac -ab 128k '/converted/80137db8c3_1334836277_int_tr_19.mp4' 2>&1

Output:

ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  1 2013 14:23:14 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.100 /  3. 35.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '80137db8c3_1334836277_int_tr_19.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2011-03-28 00:12:26
  Duration: 00:02:01.14, start: 0.000000, bitrate: 703 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 601 kb/s, 29.96 fps, 29.92 tbr, 1k tbn, 59.83 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      creation_time   : 2011-03-28 00:12:27
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
[libx264 @ 0x34ec060] using SAR=100/99
[libx264 @ 0x34ec060] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x34ec060] profile High, level 2.0
[libx264 @ 0x34ec060] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
Alternatively use the non experimental encoder 'libfaac'.


    


    Another command that I used is :

    


    FFmpeg -i !videofile -an -pass 1 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile

FFMpeg -y -i !videofile -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -preset slow -b 500k -threads auto !convertfile


    


    Output for the first pass :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 2012-08-15 17:12:37
  Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : SoundHandler
Please use -b:a or -b:v, -b is ambiguous

using SAR=1/1
[libx264 @ 0x1c39be0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x1c39be0] profile Main, level 3.0
[libx264 @ 0x1c39be0] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 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=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=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'comiccon.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    encoder         : Lavf54.61.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 1, 500 kb/s, 15360 tbn, 30 tbc
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame=139078 fps=279 q=32766.0 Lsize=  286145kB time=01:17:15.86 bitrate= 505.6kbits/s    
video:284758kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.487000%
[libx264 @ 0x1c39be0] frame I:656   Avg QP:19.51  size: 21457
[libx264 @ 0x1c39be0] frame P:76006 Avg QP:22.19  size:  3141
[libx264 @ 0x1c39be0] frame B:62416 Avg QP:26.38  size:   621
[libx264 @ 0x1c39be0] consecutive B-frames: 32.3% 17.5% 18.6% 31.6%
[libx264 @ 0x1c39be0] mb I  I16..4: 24.5%  0.0% 75.5%
[libx264 @ 0x1c39be0] mb P  I16..4:  7.5%  0.0%  0.0%  P16..4: 40.5%  0.0%  0.0%  0.0%  0.0%    skip:52.1%
[libx264 @ 0x1c39be0] mb B  I16..4:  1.4%  0.0%  0.0%  B16..8: 12.0%  0.0%  0.0%  direct: 2.9%  skip:83.7%  L0:41.1% L1:41.6% BI:17.3%
[libx264 @ 0x1c39be0] final ratefactor: 23.45
[libx264 @ 0x1c39be0] direct mvs  spatial:95.3% temporal:4.7%
[libx264 @ 0x1c39be0] coded y,uvDC,uvAC intra: 37.6% 42.8% 11.8% inter: 8.9% 8.2% 0.5%
[libx264 @ 0x1c39be0] i16 v,h,dc,p: 43% 28% 19% 10%
[libx264 @ 0x1c39be0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 21% 11%  6%  4%  5%  4%  6%  6%
[libx264 @ 0x1c39be0] i8c dc,h,v,p: 57% 19% 20%  4%
[libx264 @ 0x1c39be0] Weighted P-Frames: Y:1.4% UV:0.5%
[libx264 @ 0x1c39be0] kb/s:503.18


    


    output for the second pass :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'comiccon.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 2012-08-15 17:12:37
  Duration: 01:17:15.93, start: 0.000000, bitrate: 706 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 636 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 63 kb/s
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : SoundHandler
Please use -b:a or -b:v, -b is ambiguous
[libx264 @ 0x3247f80] using SAR=1/1
[libx264 @ 0x3247f80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x3247f80] profile High, level 3.0
[libx264 @ 0x3247f80] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=2pass mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'comiccon.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    encoder         : Lavf54.61.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 2, 500 kb/s, 15360 tbn, 30 tbc
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2012-08-15 17:12:37
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libfaac)
Press [q] to stop, [?] for help
frame=139078 fps=206 q=32766.0 Lsize=  357252kB time=01:17:15.93 bitrate= 631.3kbits/s    
video:282992kB audio:69592kB subtitle:0 global headers:0kB muxing overhead 1.324238%
[libx264 @ 0x3247f80] frame I:656   Avg QP:19.61  size: 20433
[libx264 @ 0x3247f80] frame P:76006 Avg QP:23.07  size:  2996
[libx264 @ 0x3247f80] frame B:62416 Avg QP:26.23  size:   780
[libx264 @ 0x3247f80] consecutive B-frames: 32.3% 17.5% 18.6% 31.6%
[libx264 @ 0x3247f80] mb I  I16..4: 17.2% 37.8% 44.9%
[libx264 @ 0x3247f80] mb P  I16..4:  2.9%  3.7%  1.2%  P16..4: 30.3%  6.1%  3.4%  0.0%  0.0%    skip:52.5%
[libx264 @ 0x3247f80] mb B  I16..4:  0.5%  0.6%  0.3%  B16..8: 25.9%  2.2%  0.5%  direct: 0.9%  skip:69.3%  L0:51.4% L1:43.0% BI: 5.7%
[libx264 @ 0x3247f80] 8x8 transform intra:45.9% inter:51.5%
[libx264 @ 0x3247f80] direct mvs  spatial:85.5% temporal:14.5%
[libx264 @ 0x3247f80] coded y,uvDC,uvAC intra: 47.3% 49.2% 13.5% inter: 9.0% 9.4% 0.5%
[libx264 @ 0x3247f80] i16 v,h,dc,p: 38% 27% 13% 22%
[libx264 @ 0x3247f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 16% 14%  5%  5%  7%  7%  8%  9%
[libx264 @ 0x3247f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 15%  9%  6%  7%  8%  7%  8%  8%
[libx264 @ 0x3247f80] i8c dc,h,v,p: 49% 22% 20%  8%
[libx264 @ 0x3247f80] Weighted P-Frames: Y:1.4% UV:0.5%
[libx264 @ 0x3247f80] ref P L0: 79.3% 10.4%  6.8%  1.6%  1.2%  0.7%  0.0%
[libx264 @ 0x3247f80] ref B L0: 93.6%  4.8%  1.2%  0.3%
[libx264 @ 0x3247f80] ref B L1: 96.6%  3.4%
[libx264 @ 0x3247f80] kb/s:500.06


    


    The above command produces the file correctly however it cannot be played in flash player. One thing that I noticed is this may happen if the input file is mp4 as well. This command is executed for users uploading files, so the input file could be any format.

    


    Below is the information about my FFmpeg version :
> ffmpeg version git-2013-02-01-5a67e30 Copyright (c) 2000-2013 the
> FFmpeg developers built on Feb 1 2013 14:23:14 with gcc 4.6
> (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration : —enable-gpl
> —enable-libass —enable-libfaac —enable-libfdk-aac —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-librtmp —enable-libtheora —enable-libvorbis —enable-libvpx —enable-libx264 —enable-nonfree —enable-version3 libavutil 52. 17.100 / 52. 17.100
    
libavcodec 54. 91.100 / 54. 91.100
    
libavformat 54. 61.104 / 54. 61.104
    
libavdevice 54. 3.103 / 54. 3.103
    
libavfilter 3. 35.100 / 3. 35.100
    
libswscale 2. 2.100 / 2. 2.100
    
libswresample 0. 17.102 / 0. 17.102
    
libpostproc 52. 2.100 / 52. 2.1

    


  • ffmpeg export without color loss

    27 décembre 2020, par ser

    I'm trying to add a watermark to a video through ffmpeg, but all the exports result in loss of color information. I would like to retain the same color information as the original video, how do I do that ?

    


    Currently, I use this code :

    


    ./ffmpeg -i input.MOV -loop 1 -i logo.png -codec:v libx264 -crf 18 -preset medium -filter_complex "


    


    I realised the only way to not lose the color information is to set -crf to 0 and -preset to veryslow, but it results in a really large file size. (2 times the size of original video, which is not effective)

    


    I also get this error when I run ffpmeg :

    


    [swscaler @ 0x117577000] deprecated pixel format used, make sure you did set range correctly


    


    See Image comparison here — the blacks on the export were not as "black" as original

    


    ffprobe -show_streams for Original File

    


    ffprobe version 4.3.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0930-BenjaminWong.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2020-12-22T11:31:49.000000Z
  Duration: 00:00:30.00, start: 0.000000, bitrate: 14688 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 252 kb/s (default)
    Metadata:
      creation_time   : 2020-12-22T11:31:49.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1080x1920, 14430 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2020-12-22T11:31:49.000000Z
      handler_name    : Core Media Video
      encoder         : H.264
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=1321751
duration=29.971678
bit_rate=252820
max_bit_rate=256000
bits_per_raw_sample=N/A
nb_frames=1293
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-12-22T11:31:49.000000Z
TAG:language=und
TAG:handler_name=Core Media Audio
[/STREAM]
[STREAM]
index=1
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/60
codec_tag_string=avc1
codec_tag=0x31637661
width=1080
height=1920
coded_width=1088
coded_height=1920
closed_captions=0
has_b_frames=1
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj420p
level=40
color_range=pc
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/600
start_pts=0
start_time=0.000000
duration_ts=18000
duration=30.000000
bit_rate=14430480
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=900
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-12-22T11:31:49.000000Z
TAG:language=und
TAG:handler_name=Core Media Video
TAG:encoder=H.264
[/STREAM]


    


    ffprobe -show_streams for Exported File (added filter & watermark)

    


    ffprobe version 4.3.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0930-BenjaminWong_watermarked_1080h264-5.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:30.00, start: 0.000000, bitrate: 5141 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1080x1080, 5003 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/60
codec_tag_string=avc1
codec_tag=0x31637661
width=1080
height=1080
coded_width=1088
coded_height=1088
closed_captions=0
has_b_frames=2
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj420p
level=32
color_range=pc
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=460800
duration=30.000000
bit_rate=5003599
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=900
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=1321898
duration=29.975011
bit_rate=128780
max_bit_rate=128780
bits_per_raw_sample=N/A
nb_frames=1292
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=Core Media Audio
[/STREAM]