
Recherche avancée
Médias (91)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
-
Les Miserables
4 juin 2012, par
Mis à jour : Février 2013
Langue : English
Type : Texte
-
Ne pas afficher certaines informations : page d’accueil
23 novembre 2011, par
Mis à jour : Novembre 2011
Langue : français
Type : Image
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
-
Richard Stallman et la révolution du logiciel libre - Une biographie autorisée (version epub)
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (72)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip 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, 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 (...) -
Le profil des utilisateurs
12 avril 2011, parChaque 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 user23254772I 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 inffprobe
the first subtitle iss:0
, so I subtract1
fromnums


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 variablecodecs
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 FilipI 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 thedirectory


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"
{
#include <libavformat></libavformat>avformat.h>
}

int main()
{ 
 av_log_set_level(AV_LOG_DEBUG);

 auto url = "D:/music/test.mp3";

 AVFormatContext* fmt;
 auto ret = avformat_open_input(&fmt, url, nullptr, nullptr);
 if (ret < 0)
 {
 av_log(nullptr, AV_LOG_ERROR, "Cannot open %s format : %s", url, av_err2str(ret));
 exit(EXIT_FAILURE);
 }

 av_dump_format(fmt, 0, url, 0);
}



output


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



You can see the Stream info is useless.


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


It's display normal.


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



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