Recherche avancée

Médias (91)

Autres articles (72)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • List of compatible distributions

    26 avril 2011, par

    The 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 (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (5367)

  • Windows batch - unable to assign a variable within an iterative for loop

    17 janvier 2024, par user23254772

    I am using ffprobe to get the codec_name of subtitles in media files. But when I try to get the codec extension it fails. What am I doing wrong ?

    


    I have edited this post to address the comments and include the complete batch file

    


    Re : ns.txt - this command outputs the stream number of the subtitles :

    


    C:\ffmpeg\bin\ffprobe -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 -i "%~dpnx1">ns.txt


    


    and the output in the txt file is :

    


    2
3


    


    Now I need to count the number of lines in this text file which will tell me how many subtitles my media file has :

    


    set "cmd=findstr /R /N "^^" ns.txt | find /C ":""
for /f %%a in ('!cmd!') do set nums=%%a
set /A nums=%nums%-1


    


    In this case nums = 2 but in ffprobe the first subtitle is s:0, so I subtract 1 from nums

    


    My iterative loop is :

    


    FOR %%i in (1,1,%nums%) DO (
C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams s:%%i -show_entries stream=%arg% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >sub.txt
set /p codecs=code>

    


    Which puts the codec name in sub.txt and I create the variable codecs to store this value.

    


    Then I need to determine the appropriate container [extension] for the subtitle - here I changed my code from what I posted earlier :

    


    if !codecs! == mov_text set codecs1=srt
if !codecs! == subrip set codecs1=srt
if !codecs! == ass set codecs1=ass
if !codecs! == webvtt set codecs1=vtt
if !codecs! == ttml set codecs1=ttml
if !codecs! == dvb_subtitle set codecs1=dvbsub
if !codecs! == dvd_subtitle set codecs1=dvdsub
if !codecs! == hdmv_pgs_subtitle setcodecs1=sup
if !codecs! == xsub set codecs1=xsub


    


    Then I demux [extract] the subtitle using ffmpeg :

    


    c:\ffmpeg\bin\ffmpeg -i "%~dpnx1" -an -vn -c:s "!codecs!" "%~n1_d."!codecs1!"


    


    This is working, except I have an extra iteration, my output is :

    


    Mediafile: C:\Users\UNOIT\Desktop\Tears of Steel_2sub.mkv
subtile: Tears of Steel_2sub_d.srt
subtile: Tears of Steel_2sub_d.ass
subtile: Tears of Steel_2sub_d.ass
File 'Tears of Steel_2sub_d.ass' already exists. Overwrite? [y/N]


    


    And if the media file has only one subtitle, my ffmpeg output is :

    


    Mediafile: C:\Users\UNOIT\Desktop\_Jan2024-Media\mkv\Tears of Steel_ass.mkv
subtile: Tears of Steel_ass_d.ass
subtile: Tears of Steel_ass_d.ass
File 'Tears of Steel_ass_d.ass' already exists. Overwrite? [y/N]
subtile: Tears of Steel_ass_d.ass
File 'Tears of Steel_ass_d.ass' already exists. Overwrite? [y/N]


    


    I can choose not to overwrite the file - but obviously there is a problem with my iterative loop - maybe a subroutine would work

    


    Here is the batch file :

    


    ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
set "arg=codec_name"
set "arg1=codec_name"
set "arg2=codec_name"
echo Mediafile: %~dpnx1
C:\ffmpeg\bin\ffprobe -v quiet -loglevel error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 -i "%~dpnx1" >ns.txt
set "cmd=findstr /R /N "^^" ns.txt | find /C ":""
for /f %%a in ('!cmd!') do set nums=%%a
set /A nums=%nums%-1
FOR %%i in (0,1,%nums%) DO (
    C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams s:%%i -show_entries stream=%arg% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >sub%%i.txt
    set /p codecs=code>

    


  • Subtract a specific string from a variable in a for loop

    14 octobre 2020, par Filip

    I am making a file converter with batch using FFMPEG.

    


    I have encountered a problem when trying to subtract the name of a file from the complete link to the file to get the directory of the folder it is in so after the file is converted it can be put into that directory.

    


    Can someone advise me on how I could subtract the string from the filename variable from the string in the directory

    


    My code :

    


    @echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set filetype=.flac
for /R %%a in ("*%filetype%*") do (
    set directory=%%a
    set filename=%%~na%filetype%
    set convdir=!directory:%filename%=!
    echo !convdir!
    pause
    ffmpeg -i "%%a" "convdir%%~na.wav"
    echo Converted %%a
)
echo Convertion Done!
pause


    


  • FFmpeg av_dump_format showing incorrect output, but ffprobe displays correct metadata

    29 janvier, par グルグル

    I use ffmpeg 7.1 source build on windows and compilation configuration as follow :

    


    configuration:
  --toolchain=msvc
  --arch=x86_64
  --enable-x86asm
  --enable-asm
  --enable-shared
  --enable-w32threads
  --prefix=/D/build


    


    When I use av_dump_format to print metadata of test.mp3, it display the incorrect information.

    


    extern "C"&#xA;{&#xA;#include <libavformat></libavformat>avformat.h>&#xA;}&#xA;&#xA;int main()&#xA;{ &#xA;    av_log_set_level(AV_LOG_DEBUG);&#xA;&#xA;    auto url = "D:/music/test.mp3";&#xA;&#xA;    AVFormatContext* fmt;&#xA;    auto ret = avformat_open_input(&amp;fmt, url, nullptr, nullptr);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        av_log(nullptr, AV_LOG_ERROR, "Cannot open %s format : %s", url, av_err2str(ret));&#xA;        exit(EXIT_FAILURE);&#xA;    }&#xA;&#xA;    av_dump_format(fmt, 0, url, 0);&#xA;}&#xA;

    &#xA;

    output

    &#xA;

    [AVFormatContext @ 000001768E65BC40] Opening &#x27;D:/music/test.mp3&#x27; for reading&#xA;[file @ 000001768E65C180] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;[mp3 @ 000001768E65BC40] Format mp3 probed with size=4096 and score=51&#xA;id3v2 ver:4 flags:00 len:35&#xA;[mp3 @ 000001768E65BC40] pad 576 576&#xA;[mp3 @ 000001768E65BC40] Skipping 0 bytes of junk at 462.&#xA;Input #0, mp3, from &#x27;D:/music/test.mp3&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.76.100&#xA;  Duration: N/A, bitrate: N/A&#xA;  Stream #0:0, 0, 1/14112000: Audio: mp3, 0 channels&#xA;      Metadata:&#xA;        encoder         : Lavc58.13&#xA;

    &#xA;

    You can see the Stream info is useless.

    &#xA;

    But I use ffprobe which is built with same configuration to print metadata of test.mp3.

    &#xA;

    It's display normal.

    &#xA;

    ffprobe version 7.0.1 Copyright (c) 2007-2024 the FFmpeg developers&#xA;  built with Microsoft (R) C/C&#x2B;&#x2B; Optimizing Compiler Version 19.41.34123 for x64&#xA;  configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --prefix=/D/build&#xA;  WARNING: library configuration mismatch&#xA;  avutil      configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  avcodec     configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  avformat    configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  avdevice    configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  avfilter    configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  swscale     configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  swresample  configuration: --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --enable-shared --enable-w32threads --disable-programs --disable-doc --disable-static --prefix=/D/build&#xA;  libavutil      59.  8.100 / 59. 39.100&#xA;  libavcodec     61.  3.100 / 61. 19.100&#xA;  libavformat    61.  1.100 / 61.  7.100&#xA;  libavdevice    61.  1.100 / 61.  3.100&#xA;  libavfilter    10.  1.100 / 10.  4.100&#xA;  libswscale      8.  1.100 /  8.  3.100&#xA;  libswresample   5.  1.100 /  5.  3.100&#xA;Input #0, mp3, from &#x27;D:\music\test.mp3&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.76.100&#xA;  Duration: 00:05:00.12, start: 0.025057, bitrate: 128 kb/s&#xA;  Stream #0:0: Audio: mp3 (mp3float), 44100 Hz, stereo, fltp, 128 kb/s&#xA;      Metadata:&#xA;        encoder         : Lavc58.13&#xA;

    &#xA;

    Why is av_dump_format not correctly showing stream information ? How can I fix it ?

    &#xA;