Pergunta

Eu uso uma ferramenta chamada "exiftool" para ler informações de metadados de arquivos de vídeo para listagem/categorização.A saída do Exiftool é algo assim.

1920x1080
2:58:09
12421 MB

O que eu quero é;

[1920x1080][2:58:09][12421 MB]

Isto é o que estou tentando fazer para remover o caractere “enter”;

:_Dongu2
set GELEN=%~1
set /a SAYAC2+=1
if %SAYAC2% LEQ 99 (
  if %SAYAC2% LEQ 9 (
    title Ilerleme Durumu: 00%SAYAC2% / %FSAY%
  ) else (
    title Ilerleme Durumu: 0%SAYAC2% / %FSAY%
  )
) else (
  title Ilerleme Durumu: %SAYAC2% / %FSAY%
)

setlocal DisableDelayedExpansion
set "firstLineReady="
(
    for /F "eol=$ delims=" %%a in ('exiftool -s3 -ImageSize -Duration -FileSize "%~1\%GELEN:~20,-23%.mp4"') DO (
        if defined firstLineReady (echo()
        set "firstLineReady=1"
        <nul set /p "=%%a"
    )
)>> out.txt
goto :EOF

Até agora não resolvi.Encontrei esta função em A resposta de Jeb em outra pergunta.É assim que eu chamo essa função

(for /f "tokens=*" %%x in (%MTEMP%) do call :_Dongu2 "%%x") && title %NAME%

e %MTEMP% arquivo é como

Z:\Movies\000y.001y\The.Lord.of.the.Rings.The.Fellowship.of.the.Ring.(2001){0120737}[00085]
Z:\Movies\000y.001y\The.Lord.of.the.Rings.The.Return.of.the.King.(2003){0167260}[00087]
Z:\Movies\000y.001y\The.Lord.of.the.Rings.The.Two.Towers.(2002){0167261}[00086]

a atitude de cada filme tinha que estar em outra linha.out.txt tinha que ser assim;

[1920x1080][2:58:09][12421 MB][The.Lord.of.the.Rings.The.Fellowship.of.the.Ring]
[1920x1080][3:02:31][14660 MB][The.Lord.of.the.Rings.The.Return.of.the.King]
.
.
.
Foi útil?

Solução

Aqui está uma solução em lote:

@echo off
<"file.txt" (
set /p a=
set /p b=
set /p c=
) 
echo [%a%][%b%][%c%]

Saída:

[1920x1080][2:58:09][12421 MB]

Outras dicas

Peça diretamente ao exiftool para produzir a saída necessária

exiftool -p [${ImageSize}][${Duration}][${FileSize}] videoFile.mp4
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top