
Recherche avancée
Médias (91)
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#1 The Wires
11 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (50)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Publier sur MédiaSpip
13 juin 2013Puis-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 -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (9375)
-
How to calculate vmaf score of multi-resolution webm using ffmpeg ?
13 juillet 2022, par willI’m trying to calculate the
vmaf
of two videos, one isavi
(rawvideo(I420), yuv420p), the other iswebm
(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 is56.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 is65.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 ?


-
Metadict in ffmpeg does not have rotate information
14 juillet 2022, par Lucky SundaMy aim is to extract frames out of a video but many times the frames are inverted. This is happening because "VideoCapture" in cv2 does read the rotate flag data present in the video metadata. I am running it on mac and installed "ffmpeg" package (5.0.1) using brew package manager. This is my code to check rotation present in a video using ffmpeg.


import ffmpeg 
import cv2 
import pprint 
pp = pprint.PrettyPrinter(depth=4)
def check_rotation(path_video_file):
 # this returns meta-data of the video file in form of a dictionary
 meta_dict = ffmpeg.probe(path_video_file)
 pp.pprint(meta_dict)

 # from the dictionary, meta_dict['streams'][0]['tags']['rotate'] is the key
 # we are looking for
 rotateCode = None
 if int(meta_dict['streams'][0]['tags']['rotate']) == 90:
 rotateCode = cv2.ROTATE_90_CLOCKWISE
 elif int(meta_dict['streams'][0]['tags']['rotate']) == 180:
 rotateCode = cv2.ROTATE_180
 elif int(meta_dict['streams'][0]['tags']['rotate']) == 270:
 rotateCode = cv2.ROTATE_90_COUNTERCLOCKWISE

 return rotateCode




Here the meta_dict is supposed to have information about the rotation but it is not there.
printing out meta_dict gives :


{'format': {'bit_rate': '18498544',
 'duration': '3.584000',
 'filename': 'video.mp4',
 'format_long_name': 'QuickTime / MOV',
 'format_name': 'mov,mp4,m4a,3gp,3g2,mj2',
 'nb_programs': 0,
 'nb_streams': 2,
 'probe_score': 100,
 'size': '8287348',
 'start_time': '0.000000',
 'tags': {'com.android.version': '11',
 'compatible_brands': 'isommp42',
 'creation_time': '2021-12-08T10:56:57.000000Z',
 'major_brand': 'mp42',
 'minor_version': '0'}},
 'streams': [{'avg_frame_rate': '990000/34997',
 'bit_rate': '18804651',
 'bits_per_raw_sample': '8',
 'chroma_location': 'left',
 'closed_captions': 0,
 'codec_long_name': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
 'codec_name': 'h264',
 'codec_tag': '0x31637661',
 'codec_tag_string': 'avc1',
 'codec_type': 'video',
 'coded_height': 1080,
 'coded_width': 1920,
 'color_primaries': 'bt470bg',
 'color_range': 'pc',
 'color_space': 'bt470bg',
 'color_transfer': 'smpte170m',
 'display_aspect_ratio': '16:9',
 'disposition': {'attached_pic': 0,
 'captions': 0,
 'clean_effects': 0,
 'comment': 0,
 'default': 1,
 'dependent': 0,
 'descriptions': 0,
 'dub': 0,
 'forced': 0,
 'hearing_impaired': 0,
 'karaoke': 0,
 'lyrics': 0,
 'metadata': 0,
 'original': 0,
 'still_image': 0,
 'timed_thumbnails': 0,
 'visual_impaired': 0},
 'duration': '3.499700',
 'duration_ts': 314973,
 'extradata_size': 35,
 'field_order': 'progressive',
 'film_grain': 0,
 'has_b_frames': 0,
 'height': 1080,
 'id': '0x1',
 'index': 0,
 'is_avc': 'true',
 'level': 40,
 'nal_length_size': '4',
 'nb_frames': '99',
 'pix_fmt': 'yuvj420p',
 'profile': 'High',
 'r_frame_rate': '120/1',
 'refs': 1,
 'sample_aspect_ratio': '1:1',
 'side_data_list': [{...}],
 'start_pts': 3168,
 'start_time': '0.035200',
 'tags': {'creation_time': '2021-12-08T10:56:57.000000Z',
 'handler_name': 'VideoHandle',
 'language': 'eng',
 'vendor_id': '[0][0][0][0]'},
 'time_base': '1/90000',
 'width': 1920},
 {'avg_frame_rate': '0/0',
 'bit_rate': '128986',
 'bits_per_sample': 0,
 'channel_layout': 'stereo',
 'channels': 2,
 'codec_long_name': 'AAC (Advanced Audio Coding)',
 'codec_name': 'aac',
 'codec_tag': '0x6134706d',
 'codec_tag_string': 'mp4a',
 'codec_type': 'audio',
 'disposition': {'attached_pic': 0,
 'captions': 0,
 'clean_effects': 0,
 'comment': 0,
 'default': 1,
 'dependent': 0,
 'descriptions': 0,
 'dub': 0,
 'forced': 0,
 'hearing_impaired': 0,
 'karaoke': 0,
 'lyrics': 0,
 'metadata': 0,
 'original': 0,
 'still_image': 0,
 'timed_thumbnails': 0,
 'visual_impaired': 0},
 'duration': '3.584000',
 'duration_ts': 172032,
 'extradata_size': 2,
 'id': '0x2',
 'index': 1,
 'nb_frames': '168',
 'profile': 'LC',
 'r_frame_rate': '0/0',
 'sample_fmt': 'fltp',
 'sample_rate': '48000',
 'start_pts': 0,
 'start_time': '0.000000',
 'tags': {'creation_time': '2021-12-08T10:56:57.000000Z',
 'handler_name': 'SoundHandle',
 'language': 'eng',
 'vendor_id': '[0][0][0][0]'},
 'time_base': '1/48000'}]}



Can someone please help me to find if rotation is present in a video ?


-
ffmpeg command never work in lambda function using nodejs [closed]
4 décembre 2022, par Santosh swainI am trying to implement FFmpeg video streaming functionality such as Instagram countdown functionality. In this code, first of all, I get records(URLs) from the s3 bucket and then split them according to my need, and then create the command and execute it with exec() belonging to childe_process. in this, I am trying to store the out in some specific folder in lambda function but it was never stored. I thought lambda does allow to write files locally so I am trying to do the direct upload on the s3 bucket by using the stdout parameter of exec()'s callback. guys, please help to do that. I have a question lambda does allow to write content in its local folder ? or if not allow then whats the way to do that thing ? I just share my code please guide me.



 // dependencies
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var { exec } = require('child_process');
var path = require('path')
var AWS_ACCESS_KEY = '';
var AWS_SECRET_ACCESS_KEY = '';
var fs = require('fs')

s3 = new AWS.S3({
 accessKeyId: AWS_ACCESS_KEY,
 secretAccessKey: AWS_SECRET_ACCESS_KEY
});

exports.handler = async function (event, context) {

 var bucket_name = "sycu-game";
 var bucketName = "sycu-test";

 //CREATE OVERLAY AND BG_VALUE PATH TO GET VALUE FROM S3
 const bgValue = (event.Records[0].bg_value).split('/');
 const overlayImage = (event.Records[0].overlay_image_url).split('/');


 var s3_bg_value = bgValue[3] + "/" + bgValue[4];
 var s3_overlay_image = overlayImage[4] + "/" + overlayImage[5] + "/" + overlayImage[6];
 const signedUrlExpireSeconds = 60 * 5;


 //RETREIVE BG_VALUE FROM S3 AND CREATE URL FOR FFMPEG INPUT VALUE
 var bg_value_url = s3.getSignedUrl('getObject', {
 Bucket: bucket_name,
 Key: s3_bg_value,
 Expires: signedUrlExpireSeconds
 });
 bg_value_url = bg_value_url.split("?");
 bg_value_url = bg_value_url[0];


 //RETREIVE OVERLAY IMAGE FROM S3 AND CREATE URL FOR FFMPEG INPUT VALUE 
 var overlay_image_url = s3.getSignedUrl('getObject', {
 Bucket: bucket_name,
 Key: s3_overlay_image,
 Expires: signedUrlExpireSeconds
 });
 overlay_image_url = overlay_image_url.split("?");
 overlay_image_url = overlay_image_url[0];


 //MANUAL ASSIGN VARIABLE FOR FFMPEG COMMAND 
 var command,
 ExtraTimerSec = event.Records[0].timer_seconds + 5,
 TimerSec = event.Records[0].timer_seconds + 1,
 BackgroundWidth = 1080,
 BackgroundHeight = 1920,
 videoPath = (__dirname + '/tmp/' + event.Records[0].name);
 console.log("path", videoPath)
 //TEMP DIRECTORY

 var videoPath = '/media/volume-d/generatedCountdownS3/tmp/' + event.Records[0].name
 var tmpFile = fs.createWriteStream(videoPath)
 //FFMPEG COMMAND 
 if (event.Records[0].bg_type == 2) {
 if (event.Records[0].is_rotate) {
 command = ' -stream_loop -1 -t ' + ExtraTimerSec + ' -i ' + bg_value_url + ' -i ' + overlay_image_url + ' -filter_complex "color=color=0x000000@0.0:s= ' + event.Records[0].resized_box_width + 'x' + event.Records[0].resized_box_height + ',drawtext=fontcolor=' + event.Records[0].time_text_color + ':fontsize=' + event.Records[0].time_text_size + ':x=' + event.Records[0].minute_x + ':y=' + event.Records[0].minute_y + ':text=\'%{eif\\:trunc(mod(((' + TimerSec + '-if(between(t, 0, 1),1,if(gte(t,' + TimerSec + '),' + TimerSec + ',t)))/60),60))\\:d\\:2}\',drawtext=fontcolor=' + event.Records[0].time_text_color + ':fontsize=' + event.Records[0].time_text_size + ':x=' + event.Records[0].second_x + ':y=' + event.Records[0].second_y + ':text=\'%{eif\\:trunc(mod(' + TimerSec + '-if(between(t, 0, 1),1,if(gte(t,' + TimerSec + '),' + TimerSec + ',t))\,60))\\:d\\:2}\'[txt]; [txt] rotate=' + event.Records[0].box_angle + '*PI/180:fillcolor=#00000000 [rotated];[0] scale=w=' + BackgroundWidth + ':h=' + BackgroundHeight + '[t];[1] scale=w=' + BackgroundWidth + ':h=' + BackgroundHeight + '[ot];[t][ot] overlay = :x=0 :y=0 [m1];[m1][rotated]overlay = :x=' + event.Records[0].flat_box_coordinate_x + ' :y=' + event.Records[0].flat_box_coordinate_x + ' [m2]" -map "[m2]" -pix_fmt yuv420p -t ' +
 ExtraTimerSec + ' -r 24 -c:a copy ' + videoPath + "";
 }
 else {
 command = ' -stream_loop -1 -t ' + ExtraTimerSec + ' -i ' + bg_value_url + ' -i ' + overlay_image_url + ' -filter_complex "color=color=0x000000@0.0:s= ' + event.Records[0].resized_box_width + 'x' + event.Records[0].resized_box_height + ',drawtext=fontcolor=' + event.Records[0].time_text_color + ':fontsize=' + event.Records[0].time_text_size + ':x=' + event.Records[0].minute_x + ':y=' + event.Records[0].minute_y + ':text=\'%{eif\\:trunc(mod(((' + TimerSec + '-if(between(t, 0, 1),1,if(gte(t,' + TimerSec + '),' + TimerSec + ',t)))/60),60))\\:d\\:2}\',drawtext=fontcolor=' + event.Records[0].time_text_color + ':fontsize=' + event.Records[0].time_text_size + ':x=' + event.Records[0].second_x + ':y=' + event.Records[0].second_y + ':text=\'%{eif\\:trunc(mod(' + TimerSec + '-if(between(t, 0, 1),1,if(gte(t,' + TimerSec + '),' + TimerSec + ',t))\,60))\\:d\\:2}\'[txt]; [txt] rotate=' + event.Records[0].box_angle + '*PI/180:fillcolor=#00000000 [rotated];[0] scale=w=' + BackgroundWidth + ':h=' + BackgroundHeight + '[t];[1] scale=w=' + BackgroundWidth + ':h=' + BackgroundHeight + '[ot];[t][ot] overlay = :x=0 :y=0 [m1];[m1][rotated]overlay = :x=' + event.Records[0].flat_box_coordinate_x + ' :y=' + event.Records[0].flat_box_coordinate_x + ' [m2]" -map "[m2]" -pix_fmt yuv420p -t ' +
 ExtraTimerSec + ' -r 24 -c:a copy ' + videoPath + "";
 }
 }
 var final_command = '/usr/bin/ffmpeg' + command;


 //COMMAND EXECUTE HERE

 await exec(final_command, function (err, stdout, stderr) {
 console.log("data is here")
 console.log('err:', err);
 console.log('stdout:', stdout);
 console.log('stderr:', stderr);
 const params = {
 Bucket: bucketName,
 Key: "countdown/output.mp4",
 Body: stdout,
 }
 s3.upload(params).promise().then(data => {
 console.log("data is here -->", data)
 });
 });
 var tmpFile = fs.createReadStream(videoPath)
 console.log('temp file data:', tmpFile.toString())
};