Recherche avancée

Médias (2)

Mot : - Tags -/rotation

Autres articles (97)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains 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 ;

  • Creating farms of unique websites

    13 avril 2011, par

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

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (13016)

  • Remove .travis.yml

    17 avril 2024, par Martin Storsjö
    Remove .travis.yml
    

    Travis is no longer relevant for attempting to run CI jobs in our
    setup.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] .travis.yml
  • Checking if a video has a sound even if it has an audio codec ?

    19 janvier 2023, par Sreenivasan

    I am new to intermediate python and I am trying to find if a downloaded video has sound, every video I download has an audio codec but I want to get the decibel of sound that audio has in that particular video.

    &#xA;

    For example, this 'FFmpeg' command line script allows me to get the full info :

    &#xA;

    ffmpeg -hide_banner -i testvideo.mp4 -af volumedetect -vn -f null - 2>&amp;1&#xA;

    &#xA;

    this yields the below result in my command prompt(windows user here with win 11)

    &#xA;

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;testvideo.mp4&#x27;:&#xA;&#xA;Metadata:&#xA;&#xA;major_brand : mp42&#xA;&#xA;minor_version : 0&#xA;&#xA;compatible_brands: mp42mp41isomavc1&#xA;&#xA;creation_time : 2022-04-12T23:21:45.000000Z&#xA;&#xA;Duration: 00:00:40.58, start: 0.000000, bitrate: 4104 kb/s&#xA;&#xA;Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 3846 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)&#xA;&#xA;Metadata:&#xA;&#xA;creation_time : 2022-04-12T23:21:45.000000Z&#xA;&#xA;handler_name : L-SMASH Video Handler&#xA;&#xA;vendor_id : [0][0][0][0]&#xA;&#xA;encoder : AVC Coding&#xA;&#xA;Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)&#xA;&#xA;Metadata:&#xA;&#xA;creation_time : 2022-04-12T23:21:45.000000Z&#xA;&#xA;handler_name : L-SMASH Audio Handler&#xA;&#xA;vendor_id : [0][0][0][0]&#xA;&#xA;Stream mapping:&#xA;&#xA;Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))&#xA;&#xA;Press [q] to stop, [?] for help&#xA;&#xA;Output #0, null, to &#x27;pipe:&#x27;:&#xA;&#xA;Metadata:&#xA;&#xA;major_brand : mp42&#xA;&#xA;minor_version : 0&#xA;&#xA;compatible_brands: mp42mp41isomavc1&#xA;&#xA;encoder : Lavf59.35.100&#xA;&#xA;Stream #0:0(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)&#xA;&#xA;Metadata:&#xA;&#xA;creation_time : 2022-04-12T23:21:45.000000Z&#xA;&#xA;handler_name : L-SMASH Audio Handler&#xA;&#xA;vendor_id : [0][0][0][0]&#xA;&#xA;encoder : Lavc59.56.100 pcm_s16le&#xA;&#xA;size=N/A time=00:00:40.55 bitrate=N/A speed=1.22e&#x2B;03x&#xA;&#xA;video:0kB audio:7608kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;&#xA;[Parsed_volumedetect_0 @ 0000026609be08c0] n_samples: 3895296&#xA;&#xA;[Parsed_volumedetect_0 @ 0000026609be08c0] mean_volume: -91.0 dB&#xA;&#xA;[Parsed_volumedetect_0 @ 0000026609be08c0] max_volume: -91.0 dB&#xA;&#xA;[Parsed_volumedetect_0 @ 0000026609be08c0] histogram_91db: 3895296&#xA;

    &#xA;

    As you can see there are 'parsed_volumedetect' values with dB which has a mean value of -91 dB which means the audio has no sound, i.e., the video has audio but there is no sound.

    &#xA;

    Now I am trying to do the same in python and I want to get just the mean volume value to be stored in a variable so that I can check if the video has any sound in it.

    &#xA;

    I have seen the subprocess codes so far but when I try to run my code in VS-Code - python 3.11 :

    &#xA;

    import subprocess    &#xA;result = subprocess.run(["ffmpeg", "-hide_banner", "-af", "volumedetect", "-vn", "-f", "null", "testvideo1.mp4"],&#xA;    stdout=subprocess.PIPE,&#xA;    stderr=subprocess.STDOUT,&#xA;    shell=True)&#xA;    print(result.stdout)&#xA;

    &#xA;

    It says that :

    &#xA;

    PS C:\Users\balaj\OneDrive\Documents\Programming language\python files> c:; cd &#x27;c:\Users\balaj\OneDrive\Documents\Programming language\python files&#x27;; &amp; &#x27;C:\Python311\python.exe&#x27; &#x27;c:\Users\balaj\.vscode\extensions\ms-python.python-2022.20.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher&#x27; &#x27;51760&#x27; &#x27;--&#x27; &#x27;c:\Users\balaj\OneDrive\Documents\Programming language\python files\devproject\sample.py&#x27;&#xA;&#xA;b"Output #0, null, to &#x27;testvideo1.mp4&#x27;:\r\nOutput file #0 does not contain any stream\r\n"&#xA;

    &#xA;

    Any help is much appreciated. Sorry for the long post... TIA !!!

    &#xA;

    Just a quick update :&#xA;The result is the same for video files that have sound(I tested in VLC) and don't have sound.

    &#xA;

    Another update :&#xA;I have changed the subprocess.runcode to the exact same as I called in the cmd windows :

    &#xA;

    result = subprocess.run(["ffmpeg", "-hide_banner","-i","testvideo-sound.mp4", "-af", "volumedetect", "-vn", "-f", "null", "-2>&amp;1"]&#xA;

    &#xA;

    Now the result is this :

    &#xA;

    b&#x27;The handle could not be duplicated\r\nduring redirection of handle 1.\r\n&#x27;&#xA;

    &#xA;

  • ffmpeg doesn't work when the script is launched by cron - No protocol specified, Cannot open display :0.0

    14 janvier 2024, par a k

    ffmpeg in my script doesn't work when the script is launched by cron of the root

    &#xA;

    Error : No protocol specified, Cannot open display :0.0

    &#xA;

    OS : Ubuntu 20.04

    &#xA;

    #!/bin/bash&#xA;log=/var/log/log2/log2.txt&#xA;&#xA;echo ______________ $(date) >> "$log"&#xA;echo "$""DISPLAY" "=      "  "$DISPLAY" >> "$log" ;&#xA;echo whoami &#x27;         &#x27; $(whoami) >> "$log" &#xA;echo pwd &#x27;            &#x27; $(pwd) >> "$log" &#xA;echo "$""USER" "=" &#x27;        &#x27; "$USER" >> "$log"&#xA;echo PATH &#x27;           &#x27; "$PATH" >> "$log"&#xA;echo which ffmpeg &#x27;   &#x27; $(which ffmpeg)>> "$log" &#xA;echo whereis ffmpeg &#x27; &#x27; $(whereis ffmpeg) >> "$log" &#xA;echo "\nls -l /bin/* | grep ffmpeg" &#x27;        &#x27; >> "$log"&#xA;ls -l /usr/bin/* | grep ffmpeg >> "$log"&#xA;echo "ls -l /var/log | grep log2" &#x27; &#x27;>> "$log"&#xA;ls -l /var/log | grep log2 >> "$log"&#xA;&#xA;ffmpeg -y -f x11grab -s 1366x768 -i :0.0 -r 25 /var/log/log2/test.mp4 -loglevel error 2>>"$log" &amp;&#xA;&#xA;echo "pid ffmpeg ""$""!"" = " "$!" >> "$log" &#xA;sleep 5&#xA;kill "$!"&#xA;echo exit >> "$log"&#xA;exit&#xA;

    &#xA;

    When Cron (Cron of the root) launches the script, ffmpeg shows the error "No protocol specified, Cannot open display :0.0"

    &#xA;

    /var/log/log2/log2.txt :

    &#xA;

    ______________ ven. 05 mai 2023 04:10:01 CEST&#xA;$DISPLAY =       &#xA;whoami           root&#xA;pwd              /root&#xA;$USER =          &#xA;PATH             /usr/bin:/bin&#xA;which ffmpeg     /usr/bin/ffmpeg&#xA;whereis ffmpeg   ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz&#xA;ls -l /usr/bin/* | grep ffmpeg  &#xA;-rwxr-xr-x 1 root   root      284976 mai   18  2022 /usr/bin/ffmpeg&#xA;ls -l /var/log | grep log2  &#xA;drwxrwxrwx  2 root              root               4096 mai    5 04:09 log2&#xA;pid ffmpeg $! =  74590&#xA;No protocol specified&#xA;[x11grab @ 0x56244aa06740] Cannot open display :0.0, error 1.&#xA;:0.0: Input/output error&#xA;exit&#xA;

    &#xA;

    When I launch the script manually as a not-root user (with sudo), everything work correctly :

    &#xA;

    ______________ ven. 05 mai 2023 04:10:47 CEST&#xA;$DISPLAY =       :0&#xA;whoami           root&#xA;pwd              /home/an&#xA;$USER =          root&#xA;PATH             /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin&#xA;which ffmpeg     /usr/bin/ffmpeg&#xA;whereis ffmpeg   ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz&#xA;ls -l /usr/bin/* | grep ffmpeg  &#xA;-rwxr-xr-x 1 root   root      284976 mai   18  2022 /usr/bin/ffmpeg&#xA;ls -l /var/log | grep log2  &#xA;drwxrwxrwx  2 root              root               4096 mai    5 04:09 log2&#xA;pid ffmpeg $! =  74618&#xA;exit&#xA;

    &#xA;

    When I launch the script manually as the root, everything works correctly :

    &#xA;

    ______________ ven. 05 mai 2023 04:11:27 CEST&#xA;$DISPLAY =       :0&#xA;whoami           root&#xA;pwd              /root&#xA;$USER =          root&#xA;PATH             /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin&#xA;which ffmpeg     /usr/bin/ffmpeg&#xA;whereis ffmpeg   ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz&#xA;ls -l /usr/bin/* | grep ffmpeg  &#xA;-rwxr-xr-x 1 root   root      284976 mai   18  2022 /usr/bin/ffmpeg&#xA;ls -l /var/log | grep log2  &#xA;drwxrwxrwx  2 root              root               4096 mai    5 04:11 log2&#xA;pid ffmpeg $! =  74683&#xA;exit&#xA;

    &#xA;

    When crontab of an ordinary user launches the script, it works correctly :

    &#xA;

    $DISPLAY =       &#xA;whoami           an&#xA;pwd              /home/an&#xA;$USER =          &#xA;PATH             /usr/bin:/bin&#xA;which ffmpeg     /usr/bin/ffmpeg&#xA;whereis ffmpeg   ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz&#xA;ls -l /usr/bin/* | grep ffmpeg  &#xA;-rwxr-xr-x 1 root   root      284976 mai   18  2022 /usr/bin/ffmpeg&#xA;ls -l /var/log | grep log2  &#xA;drwxrwxrwx  2 root              root               4096 mai    5 05:05 log2&#xA;pid ffmpeg $! =  77601&#xA;exit&#xA;

    &#xA;

    I have tried to put into the script :

    &#xA;

    export DISPLAY=":0"

    &#xA;

    export DISPLAY=":0.0"

    &#xA;

    export DISPLAY=":1"

    &#xA;