
Recherche avancée
Autres articles (35)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)
Sur d’autres sites (6038)
-
FFMPEG command runs in terminal but not by subprocess
1er septembre 2022, par BasiliqueI am trying to run a bash command using the
subprocess
module from withinpython 3.10
.

The bash command is :


ffmpeg -framerate 1 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4



In terminal the command runs fine. Here is the output :


ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100
Input #0, image2, from '*.png':
 Duration: 00:16:39.00, start: 0.000000, bitrate: N/A
 Stream #0:0: Video: png, rgba(pc), 895x332 [SAR 3937:3937 DAR 895:332], 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
 Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55726ab95d00] using SAR=1/1
[libx264 @ 0x55726ab95d00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x55726ab95d00] profile High, level 2.2
[libx264 @ 0x55726ab95d00] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=10 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
 Metadata:
 encoder : Lavf58.29.100
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 894x332 [SAR 1:1 DAR 447:166], q=-1--1, 1 fps, 16384 tbn, 1 tbc
 Metadata:
 encoder : Lavc58.54.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 173 fps=0.0 q=17.0 size= 512kB time=00:01:56.00 bitrate= 36.2kbits/frame= 351 fps=350 q=17.0 size= 1536kB time=00:04:54.00 bitrate= 42.8kbits/frame= 517 fps=343 q=17.0 size= 2560kB time=00:07:40.00 bitrate= 45.6kbits/frame= 725 fps=361 q=17.0 size= 3328kB time=00:11:08.00 bitrate= 40.8kbits/frame= 913 fps=364 q=17.0 size= 4352kB time=00:14:16.00 bitrate= 41.6kbits/frame= 999 fps=361 q=-1.0 Lsize= 4986kB time=00:16:36.00 bitrate= 41.0kbits/s speed= 360x 
video:4974kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.241361%
[libx264 @ 0x55726ab95d00] frame I:4 Avg QP: 6.12 size: 24072
[libx264 @ 0x55726ab95d00] frame P:346 Avg QP:12.94 size: 5708
[libx264 @ 0x55726ab95d00] frame B:649 Avg QP:18.19 size: 4655
[libx264 @ 0x55726ab95d00] consecutive B-frames: 5.8% 16.0% 20.1% 58.1%
[libx264 @ 0x55726ab95d00] mb I I16..4: 59.1% 10.6% 30.4%
[libx264 @ 0x55726ab95d00] mb P I16..4: 5.6% 0.6% 2.2% P16..4: 10.5% 4.3% 2.3% 0.0% 0.0% skip:74.5%
[libx264 @ 0x55726ab95d00] mb B I16..4: 2.2% 0.1% 1.7% B16..8: 16.9% 4.8% 1.6% direct: 1.1% skip:71.5% L0:50.9% L1:45.2% BI: 3.9%
[libx264 @ 0x55726ab95d00] 8x8 transform intra:5.9% inter:10.4%
[libx264 @ 0x55726ab95d00] coded y,uvDC,uvAC intra: 20.1% 18.3% 17.3% inter: 4.7% 4.7% 4.6%
[libx264 @ 0x55726ab95d00] i16 v,h,dc,p: 66% 33% 1% 0%
[libx264 @ 0x55726ab95d00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 8% 73% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x55726ab95d00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 31% 31% 2% 3% 2% 4% 2% 3%
[libx264 @ 0x55726ab95d00] i8c dc,h,v,p: 73% 23% 3% 0%
[libx264 @ 0x55726ab95d00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55726ab95d00] ref P L0: 57.2% 1.5% 24.3% 17.0%
[libx264 @ 0x55726ab95d00] ref B L0: 69.6% 24.8% 5.6%
[libx264 @ 0x55726ab95d00] ref B L1: 92.4% 7.6%
[libx264 @ 0x55726ab95d00] kb/s:40.78



In my python script I tried the following solutions :


video_cmd = """ffmpeg -framerate 1 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4"""

subprocess.run(shlex.split(video_cmd), shell=False, cwd=path_viz, stderr=subprocess.STDOUT, check=True, text=False)

subprocess.run(video_cmd, shell=True, cwd=path_viz, stderr=subprocess.STDOUT, check=True, text=False)



as well as the solution proposed for this similar question


subprocess.Popen(video_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)



None of them worked. Apparently, the right command is run (output of the
check_out
function) :

Command 'ffmpeg -y -framerate 1 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4' returned non-zero exit status 1.



the first part of the job (up to
Stream mapping:
) is done also correctly :

fmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 7.3.0 (crosstool-NG 1.23.0.449-a04d0)
 configuration: --prefix=/home/rsghazanfari/anaconda3/envs/_cuda --cc=/opt/conda/conda-bld/ffmpeg_1597178665428/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lame
 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
Input #0, image2, from '*.png':
 Duration: 00:16:39.00, start: 0.000000, bitrate: N/A
 Stream #0:0: Video: png, rgba(pc), 895x332 [SAR 3937:3937 DAR 895:332], 1 fps, 1 tbr, 1 tbn, 1 tbc



but it then pops up the following error :


Unknown encoder 'libx264'
Traceback (most recent call last):
 File "/home/rsgh/anaconda3/envs/_cuda/lib/python3.10/code.py", line 90, in runcode
 exec(code, self.locals)
 File "<input />", line 1, in <module>
 File "/home/rsgh/anaconda3/envs/_cuda/lib/python3.10/subprocess.py", line 524, in run
 raise CalledProcessError(retcode, process.args,

subprocess.CalledProcessError: Command 'ffmpeg -y -framerate 1 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4' returned non-zero exit status 1.
</module>


Any ideas of why this error is produced in python while in terminal it runs fine ? Thank you in advance.


PS :
ffmpeg -version
outputs :

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100



ubuntu version :


Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal



-
Live video in facebook is lagging while using ffmpeg from video link
1er septembre 2022, par Isteyak AliLivevideo in facebook is working fine for local device video(case 1) but its having lagging issue from video link(case 2) using FFMPEG.


Please find command for the same and log.


Case 1 - Command : ffmpeg -re -i videoplayback.mp4 -c:v libx264 -c:a aac -f flv "rtmps ://live-api-s.facebook.com:443/rtmp/5162241770554550 ?s_bl=1&s_oil=2&s_psm=1&s_sw=0&s_tids=1&s_vt=api-s&a=Aby_ZWutqdUZR26F"


Log -
2022-09-01 18:27:19.683 frame= 9 fps=0.0 q=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=21 drop=0 speed= 0x

2022-09-01 18:27:20.163 frame= 19 fps= 19 q=0.0 q=33.0 size= 0kB time=00:00:00.44 bitrate= 8.7kbits/s dup=44 drop=0 speed=0.437x

2022-09-01 18:27:20.879 frame= 32 fps= 21 q=0.0 q=33.0 size= 0kB time=00:00:00.92 bitrate= 4.1kbits/s dup=74 drop=0 speed=0.616x

2022-09-01 18:27:21.374 frame= 47 fps= 22 q=0.0 q=33.0 size= 0kB time=00:00:01.41 bitrate= 2.7kbits/s dup=109 drop=0 speed=0.651x

2022-09-01 18:27:21.940 frame= 58 fps= 21 q=29.0 q=33.0 size= 40kB time=00:00:01.90 bitrate= 174.2kbits/s dup=135 drop=0 speed=0.703x

2022-09-01 18:27:22.530 frame= 69 fps= 21 q=29.0 q=33.0 size= 101kB time=00:00:01.92 bitrate= 429.9kbits/s dup=161 drop=0 speed=0.585x

2022-09-01 18:27:23.003 frame= 83 fps= 22 q=29.0 q=33.0 size= 165kB time=00:00:02.39 bitrate= 566.5kbits/s dup=193 drop=0 speed=0.623x

2022-09-01 18:27:23.567 frame= 97 fps= 22 q=29.0 q=33.0 size= 235kB time=00:00:02.90 bitrate= 661.9kbits/s dup=226 drop=0 speed=0.667x

2022-09-01 18:27:24.133 frame= 111 fps= 23 q=29.0 q=33.0 size= 315kB time=00:00:03.36 bitrate= 765.8kbits/s dup=259 drop=0 speed=0.693x

2022-09-01 18:27:24.715 frame= 125 fps= 23 q=29.0 q=30.0 size= 385kB time=00:00:03.85 bitrate= 817.5kbits/s dup=291 drop=0 speed=0.703x

2022-09-01 18:27:25.227 frame= 142 fps= 24 q=29.0 q=33.0 size= 486kB time=00:00:04.83 bitrate= 824.6kbits/s dup=331 drop=0 speed=0.802x

2022-09-01 18:27:25.712 frame= 158 fps= 24 q=29.0 q=33.0 size= 563kB time=00:00:05.31 bitrate= 867.6kbits/s dup=368 drop=0 speed=0.811x

2022-09-01 18:27:26.262 frame= 173 fps= 24 q=29.0 q=33.0 size= 634kB time=00:00:05.78 bitrate= 897.8kbits/s dup=403 drop=0 speed=0.819x

2022-09-01 18:27:26.796 frame= 191 fps= 25 q=29.0 q=33.0 size= 718kB time=00:00:06.24 bitrate= 941.7kbits/s dup=445 drop=0 speed=0.82x

2022-09-01 18:27:27.337 frame= 211 fps= 26 q=29.0 q=33.0 size= 806kB time=00:00:07.17 bitrate= 920.7kbits/s dup=492 drop=0 speed=0.882x

2022-09-01 18:27:27.816 frame= 233 fps= 27 q=29.0 q=33.0 size= 921kB time=00:00:07.64 bitrate= 987.4kbits/s dup=543 drop=0 speed=0.881x

2022-09-01 18:27:28.348 frame= 251 fps= 27 q=29.0 q=30.0 size= 1031kB time=00:00:08.42 bitrate=1001.9kbits/s dup=585 drop=0 speed=0.919x

2022-09-01 18:27:28.868 frame= 274 fps= 28 q=29.0 q=33.0 size= 1141kB time=00:00:09.03 bitrate=1035.2kbits/s dup=639 drop=0 speed=0.933x

2022-09-01 18:27:29.393 frame= 293 fps= 29 q=29.0 q=33.0 size= 1283kB time=00:00:09.49 bitrate=1106.5kbits/s dup=683 drop=0 speed=0.932x

2022-09-01 18:27:29.870 frame= 313 fps= 29 q=29.0 q=33.0 size= 1433kB time=00:00:10.42 bitrate=1125.6kbits/s dup=730 drop=0 speed=0.975x

2022-09-01 18:27:30.356 frame= 331 fps= 30 q=29.0 q=33.0 size= 1557kB time=00:00:10.89 bitrate=1170.9kbits/s dup=772 drop=0 speed=0.973x

2022-09-01 18:27:30.843 frame= 346 fps= 30 q=29.0 q=33.0 size= 1627kB time=00:00:11.35 bitrate=1174.1kbits/s dup=807 drop=0 speed=0.971x

2022-09-01 18:27:31.357 frame= 361 fps= 30 q=29.0 q=33.0 size= 1711kB time=00:00:11.81 bitrate=1186.2kbits/s dup=842 drop=0 speed=0.969x

2022-09-01 18:27:31.862 frame= 376 fps= 30 q=29.0 q=33.0 size= 1789kB time=00:00:12.28 bitrate=1193.3kbits/s dup=877 drop=0 speed=0.967x

2022-09-01 18:27:32.371 frame= 391 fps= 30 q=29.0 q=33.0 size= 1870kB time=00:00:12.74 bitrate=1201.8kbits/s dup=912 drop=0 speed=0.965x

2022-09-01 18:27:32.908 frame= 406 fps= 30 q=29.0 q=33.0 size= 1959kB time=00:00:13.67 bitrate=1173.3kbits/s dup=947 drop=0 speed=0.997x

2022-09-01 18:27:33.109 frame= 422 fps= 30 q=29.0 q=33.0 size= 2061kB time=00:00:14.14 bitrate=1193.8kbits/s dup=984 drop=0 speed=0.992x

Case 2 - Command : ffmpeg -re -i "https://rr1---sn-o58g5ob-nu8e.googlevideo.com/videoplayback?expire=1662057728&ei=n6gQY-D9OLSA4-EPzJKYyA0&ip=103.11.117.194&id=o-AOgjPoKU_GiUy425eSSF6tHEIQvoHpsUyyIHnHERk6YS&itag=22&source=youtube&requiressl=yes&mh=6k&mm=31%2C29&mn=sn-o58g5ob-nu8e%2Csn-cvhelnls&ms=au%2Crdu&mv=m&mvi=1&pcm2cms=yes&pl=24&initcwndbps=867500&vprv=1&mime=video%2Fmp4&ns=z8jzAKb15xkjMcyG0dBthZQH&ratebypass=yes&dur=256.116&lmt=1649507860591021&mt=1662035606&fvip=3&fexp=24001373%2C24007246&c=WEB&rbqsm=fr&txp=4532434&n=PSC3ywazY86ChDwPP2&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAI-aPoysSukxGNgmlsn-4bgCG84gQnILTkGJR8WQnK_bAiEArwSM0z-GYO4SinkzgdGG5qZJtoiP3ROYneg88sOjhv4%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAJb7JQbSPhhH2jte8pE0G0iWf1LtRlEzQgSy-2pBGPg3AiBWX0P27KU2xwazMGLiBaQanUOeytB0jPgFsJleM8DO-w%3D%3D" -c:v libx264 -c:a aac -f flv "rtmps ://live-api-s.facebook.com:443/rtmp/5162241770554550 ?s_bl=1&s_oil=2&s_psm=1&s_sw=0&s_tids=1&s_vt=api-s&a=Aby_ZWutqdUZR26F"


Log -


2022-09-01 18:24:23.080 frame= 9 fps=0.0 q=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=21 drop=0 speed= 0x

2022-09-01 18:24:23.579 frame= 23 fps= 22 q=0.0 q=33.0 size= 0kB time=00:00:00.44 bitrate= 8.7kbits/s dup=53 drop=0 speed=0.427x

2022-09-01 18:24:24.177 frame= 33 fps= 21 q=0.0 q=33.0 size= 0kB time=00:00:00.92 bitrate= 4.1kbits/s dup=77 drop=0 speed=0.589x

2022-09-01 18:24:24.872 frame= 39 fps= 18 q=0.0 q=33.0 size= 0kB time=00:00:00.99 bitrate= 3.9kbits/s dup=91 drop=0 speed=0.458x

2022-09-01 18:24:25.513 frame= 46 fps= 16 q=0.0 q=33.0 size= 0kB time=00:00:01.41 bitrate= 2.7kbits/s dup=107 drop=0 speed=0.497x

2022-09-01 18:24:26.070 frame= 52 fps= 15 q=0.0 q=33.0 size= 0kB time=00:00:01.41 bitrate= 2.7kbits/s dup=121 drop=0 speed=0.41x

2022-09-01 18:24:26.602 frame= 58 fps= 14 q=29.0 q=33.0 size= 40kB time=00:00:01.90 bitrate= 174.2kbits/s dup=135 drop=0 speed=0.468x

2022-09-01 18:24:27.341 frame= 63 fps= 14 q=29.0 q=33.0 size= 72kB time=00:00:01.90 bitrate= 311.6kbits/s dup=147 drop=0 speed=0.417x

2022-09-01 18:24:27.957 frame= 71 fps= 13 q=29.0 q=33.0 size= 115kB time=00:00:02.39 bitrate= 392.6kbits/s dup=165 drop=0 speed=0.448x

2022-09-01 18:24:28.621 frame= 78 fps= 13 q=29.0 q=33.0 size= 141kB time=00:00:02.39 bitrate= 483.2kbits/s dup=182 drop=0 speed=0.409x

2022-09-01 18:24:29.277 frame= 82 fps= 12 q=29.0 q=33.0 size= 154kB time=00:00:02.39 bitrate= 527.3kbits/s dup=191 drop=0 speed=0.363x

2022-09-01 18:24:29.851 frame= 89 fps= 12 q=29.0 q=33.0 size= 197kB time=00:00:02.87 bitrate= 560.9kbits/s dup=207 drop=0 speed=0.397x

2022-09-01 18:24:30.385 frame= 96 fps= 12 q=29.0 q=33.0 size= 233kB time=00:00:02.87 bitrate= 662.2kbits/s dup=224 drop=0 speed=0.371x

2022-09-01 18:24:31.119 frame= 100 fps= 12 q=29.0 q=33.0 size= 253kB time=00:00:03.36 bitrate= 615.5kbits/s dup=233 drop=0 speed=0.402x

2022-09-01 18:24:31.449 frame= 110 fps= 12 q=29.0 q=33.0 size= 309kB time=00:00:03.36 bitrate= 750.7kbits/s dup=256 drop=0 speed=0.378x

2022-09-01 18:24:32.062 frame= 111 fps= 12 q=29.0 q=33.0 size= 315kB time=00:00:03.83 bitrate= 672.9kbits/s dup=259 drop=0 speed=0.405x

2022-09-01 18:24:32.696 frame= 122 fps= 12 q=29.0 q=33.0 size= 371kB time=00:00:03.85 bitrate= 787.6kbits/s dup=284 drop=0 speed=0.383x

2022-09-01 18:24:33.374 frame= 130 fps= 12 q=29.0 q=33.0 size= 410kB time=00:00:04.34 bitrate= 773.0kbits/s dup=303 drop=0 speed=0.407x

2022-09-01 18:24:33.987 frame= 139 fps= 12 q=29.0 q=33.0 size= 475kB time=00:00:04.34 bitrate= 895.9kbits/s dup=324 drop=0 speed=0.383x

2022-09-01 18:24:34.445 frame= 146 fps= 12 q=29.0 q=33.0 size= 508kB time=00:00:04.83 bitrate= 861.9kbits/s dup=340 drop=0 speed=0.404x

2022-09-01 18:24:35.218 frame= 153 fps= 12 q=29.0 q=33.0 size= 540kB time=00:00:05.03 bitrate= 878.1kbits/s dup=357 drop=0 speed=0.405x

2022-09-01 18:24:35.558 frame= 163 fps= 12 q=29.0 q=33.0 size= 580kB time=00:00:05.31 bitrate= 893.8kbits/s dup=380 drop=0 speed=0.408x

2022-09-01 18:24:36.220 frame= 167 fps= 12 q=29.0 q=33.0 size= 609kB time=00:00:05.31 bitrate= 938.0kbits/s dup=389 drop=0 speed=0.392x

2022-09-01 18:24:36.821 frame= 172 fps= 12 q=29.0 q=33.0 size= 630kB time=00:00:05.78 bitrate= 892.5kbits/s dup=401 drop=0 speed=0.408x

2022-09-01 18:24:37.428 frame= 179 fps= 12 q=29.0 q=33.0 size= 666kB time=00:00:05.78 bitrate= 943.1kbits/s dup=417 drop=0 speed=0.394x

2022-09-01 18:24:37.812 frame= 185 fps= 12 q=29.0 q=30.0 size= 689kB time=00:00:06.24 bitrate= 903.2kbits/s dup=431 drop=0 speed=0.41x

2022-09-01 18:24:38.368 frame= 190 fps= 12 q=29.0 q=33.0 size= 711kB time=00:00:06.24 bitrate= 932.5kbits/s dup=443 drop=0 speed=0.396x

2022-09-01 18:24:38.979 frame= 195 fps= 12 q=29.0 q=33.0 size= 737kB time=00:00:06.52 bitrate= 925.4kbits/s dup=455 drop=0 speed=0.399x

2022-09-01 18:24:39.706 frame= 204 fps= 12 q=29.0 q=33.0 size= 778kB time=00:00:06.71 bitrate= 949.8kbits/s dup=476 drop=0 speed=0.398x

2022-09-01 18:24:40.252 frame= 212 fps= 12 q=29.0 q=33.0 size= 808kB time=00:00:07.17 bitrate= 922.8kbits/s dup=494 drop=0 speed=0.407x

2022-09-01 18:24:40.977 frame= 220 fps= 12 q=29.0 q=33.0 size= 841kB time=00:00:07.17 bitrate= 960.6kbits/s dup=513 drop=0 speed=0.395x

2022-09-01 18:24:41.926 frame= 226 fps= 12 q=29.0 q=33.0 size= 886kB time=00:00:07.64 bitrate= 949.8kbits/s dup=527 drop=0 speed=0.404x

2022-09-01 18:24:42.470 frame= 233 fps= 12 q=29.0 q=33.0 size= 921kB time=00:00:07.64 bitrate= 987.4kbits/s dup=543 drop=0 speed=0.385x

2022-09-01 18:24:43.081 frame= 237 fps= 12 q=29.0 q=33.0 size= 942kB time=00:00:07.66 bitrate=1007.5kbits/s dup=553 drop=0 speed=0.374x

2022-09-01 18:24:43.745 frame= 241 fps= 11 q=29.0 q=33.0 size= 971kB time=00:00:08.10 bitrate= 981.5kbits/s dup=562 drop=0 speed=0.384x

2022-09-01 18:24:44.270 frame= 248 fps= 11 q=29.0 q=33.0 size= 1011kB time=00:00:08.10 bitrate=1021.5kbits/s dup=578 drop=0 speed=0.373x

2022-09-01 18:24:45.085 frame= 251 fps= 11 q=29.0 q=30.0 size= 1031kB time=00:00:08.10 bitrate=1042.1kbits/s dup=585 drop=0 speed=0.364x

As per my knowledge we have to add such type of delay or late stream video using some command.


-
Python : Extracting device and lens information from video metadata
14 mai 2023, par cat_got_my_tongueI am interested in extracting device and lens information from videos. Specifically, make and model of the device and the focal length. I was able to do this successfully for still images using the
exifread
module and extract a whole bunch of very useful information :

image type : MPO
Image ImageDescription: Shot with DxO ONE
Image Make: DxO
Image Model: DxO ONE
Image Orientation: Horizontal (normal)
Image XResolution: 300
Image YResolution: 300
Image ResolutionUnit: Pixels/Inch
Image Software: V3.0.0 (2b448a1aee) APP:1.0
Image DateTime: 2022:04:05 14:53:45
Image YCbCrCoefficients: [299/1000, 587/1000, 57/500]
Image YCbCrPositioning: Centered
Image ExifOffset: 158
Thumbnail Compression: JPEG (old-style)
Thumbnail XResolution: 300
Thumbnail YResolution: 300
Thumbnail ResolutionUnit: Pixels/Inch
Thumbnail JPEGInterchangeFormat: 7156
Thumbnail JPEGInterchangeFormatLength: 24886
EXIF ExposureTime: 1/3
EXIF FNumber: 8
EXIF ExposureProgram: Aperture Priority
EXIF ISOSpeedRatings: 100
EXIF SensitivityType: ISO Speed
EXIF ISOSpeed: 100
EXIF ExifVersion: 0221
EXIF DateTimeOriginal: 2022:04:05 14:53:45
EXIF DateTimeDigitized: 2022:04:05 14:53:45
EXIF ComponentsConfiguration: CrCbY
EXIF CompressedBitsPerPixel: 3249571/608175
EXIF ExposureBiasValue: 0
EXIF MaxApertureValue: 212/125
EXIF SubjectDistance: 39/125
EXIF MeteringMode: MultiSpot
EXIF LightSource: Unknown
EXIF Flash: Flash did not fire
EXIF FocalLength: 1187/100
EXIF SubjectArea: [2703, 1802, 675, 450]
EXIF MakerNote: [68, 88, 79, 32, 79, 78, 69, 0, 12, 0, 0, 0, 21, 0, 3, 0, 5, 0, 2, 0, ... ]
EXIF SubSecTime: 046
EXIF SubSecTimeOriginal: 046
EXIF SubSecTimeDigitized: 046
EXIF FlashPixVersion: 0100
EXIF ColorSpace: sRGB
EXIF ExifImageWidth: 5406
EXIF ExifImageLength: 3604
Interoperability InteroperabilityIndex: R98
Interoperability InteroperabilityVersion: [48, 49, 48, 48]
EXIF InteroperabilityOffset: 596
EXIF FileSource: Digital Camera
EXIF ExposureMode: Auto Exposure
EXIF WhiteBalance: Auto
EXIF DigitalZoomRatio: 1
EXIF FocalLengthIn35mmFilm: 32
EXIF SceneCaptureType: Standard
EXIF ImageUniqueID: C01A1709306530020220405185345046
EXIF BodySerialNumber: C01A1709306530



Unfortunately, I have been unable to extract this kind of info from videos so far.


This is what I have tried so far, with the
ffmpeg
module :

import ffmpeg
from pprint import pprint

test_video = "my_video.mp4"
pprint(ffmpeg.probe(test_video)["streams"])



And the output I get contains a lot of info but nothing related to the device or lens, which is what I am looking for :


[{'avg_frame_rate': '30/1',
 'bit_rate': '1736871',
 'bits_per_raw_sample': '8',
 'chroma_location': 'left',
 'codec_long_name': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
 'codec_name': 'h264',
 'codec_tag': '0x31637661',
 'codec_tag_string': 'avc1',
 'codec_time_base': '1/60',
 'codec_type': 'video',
 'coded_height': 1088,
 'coded_width': 1920,
 'display_aspect_ratio': '16:9',
 'disposition': {'attached_pic': 0,
 'clean_effects': 0,
 'comment': 0,
 'default': 1,
 'dub': 0,
 'forced': 0,
 'hearing_impaired': 0,
 'karaoke': 0,
 'lyrics': 0,
 'original': 0,
 'timed_thumbnails': 0,
 'visual_impaired': 0},
 'duration': '20.800000',
 'duration_ts': 624000,
 'has_b_frames': 0,
 'height': 1080,
 'index': 0,
 'is_avc': 'true',
 'level': 40,
 'nal_length_size': '4',
 'nb_frames': '624',
 'pix_fmt': 'yuv420p',
 'profile': 'Constrained Baseline',
 'r_frame_rate': '30/1',
 'refs': 1,
 'sample_aspect_ratio': '1:1',
 'start_pts': 0,
 'start_time': '0.000000',
 'tags': {'creation_time': '2021-05-08T13:23:20.000000Z',
 'encoder': 'AVC Coding',
 'handler_name': 'VideoHandler',
 'language': 'und'},
 'time_base': '1/30000',
 'width': 1920},
 {'avg_frame_rate': '0/0',
 'bit_rate': '79858',
 '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_time_base': '1/48000',
 'codec_type': 'audio',
 'disposition': {'attached_pic': 0,
 'clean_effects': 0,
 'comment': 0,
 'default': 1,
 'dub': 0,
 'forced': 0,
 'hearing_impaired': 0,
 'karaoke': 0,
 'lyrics': 0,
 'original': 0,
 'timed_thumbnails': 0,
 'visual_impaired': 0},
 'duration': '20.864000',
 'duration_ts': 1001472,
 'index': 1,
 'max_bit_rate': '128000',
 'nb_frames': '978',
 'profile': 'LC',
 'r_frame_rate': '0/0',
 'sample_fmt': 'fltp',
 'sample_rate': '48000',
 'start_pts': 0,
 'start_time': '0.000000',
 'tags': {'creation_time': '2021-05-08T13:23:20.000000Z',
 'handler_name': 'SoundHandler',
 'language': 'und'},
 'time_base': '1/48000'}]



Are these pieces of info available for videos ? Should I be using a different package ?


Thanks.


Edit :


pprint(ffmpeg.probe(test_video)["format"])
gives

{'bit_rate': '1815244',
 'duration': '20.864000',
 'filename': 'my_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': '4734158',
 'start_time': '0.000000',
 'tags': {'artist': 'Microsoft Game DVR',
 'compatible_brands': 'mp41isom',
 'creation_time': '2021-05-08T12:12:33.000000Z',
 'major_brand': 'mp42',
 'minor_version': '0',
 'title': 'Snipping Tool'}}