max5moritz
Goto Top

Audio- oder Video.flv schnell in -.mp3 oder -.mp4 umwandeln

Hallo Media-Freunde,

heute ein Tool, das die schnelle Umwandlung von Audio- oder Video*.flv in *.mp3 oder *.mp4 erledigt.
Und: es kann noch viel mehr. Viel Spaß beim Ausprobieren.

back-to-topWozu FLV-to?

Wer öfter bei "youTube" oder in sonstigen Mediatheken herumstöbert und sich auch die eine oder andere Datei herunterlädt,
der hat dann oft eine *.flv Datei auf seiner Festplatte.
Zwar gibt es online-Tools die eine Umwandung anbieten, was aber oft eine Anmeldung verlangt.

Mit "FLV-to" ist das anders. Und es kann noch mehr:
Auch *.ac3 *.avi *.drv *.flv *.mkv *.mpg *.mp2 *.ps *.trp *.ts *.wav" werden in das passende Audio- oder Video-Format umgewandelt.
Zwar ist die Stream-Zahl auf zwei beschränkt, doch dafür werden komplette Ordner verarbeitet. Und:
Für die anderen Fälle gibt es ja "Film-Montage" face-smile


Zur Beachtung:
Für die externen Programme wird wieder ein Start-set-Skript erwartet.
Siehe dazu "Film-Montage" unter :startSet. Einfach die Zeilen 613-631 in eine eigenen Skript packen, Doppelklick, anpassen, fertig.

Neben "ffmpeg" wird "sox" benötigt, beide sind in "Hybrid" enthalten.
Und wer die *.mp3 gleich noch zuschneiden möchte, der braucht "mp3DirectCut".
Die Variable %weg% ist eine Art Spezial-Papierkorb. Eigentlich nur ein Ordner, der in Start-set definiert ist.
Dort finden sich dann die input-Dateien und Zwischenschritte (mp3-Cuts), die ja in der Regel "weg" können.


back-to-topAblauf

Ich habe eine Verküpfung zu "Fly-to" im sendTo-Ordner. Dadurch ist das Tool immer nur ein Rechtsklick entfernt.
Der Skript untersucht die Datei, setzt die Werte und beginnt mit dem Umlabeln. Ein Encodieren findet im Regelfall nicht statt -
außer z.B. *.wav zu *.mp3, das geht ja auch wohl nicht anders... face-wink
Der Regelfall sind ja *.flv und die sind ja bereits encodiert, allein sie stecken im "falschen" Container.
Die Input-Dateien haben nach der Verarbeitung den Vorsatz "newMux_" und befinden sich im %weg%-Ordner.
Da die "Inputs" nicht wirklich gelöscht werden, wird also reichlich Platz gebraucht - was bei den heutigen Plattengrößen
wohl eher kein Problem mehr ist? Wen das stört und mutig ist, der kann die move-Befehle, die auf den %weg%-Ordner lauten,
in del-Befehle umwandeln. Die %weg%-Variable ist dann überflüssig. Ich gehe aber den sicheren Weg, ich lösche eigenhändig.

back-to-topDer Skript

@echo off&setlocal enabledelayedexpansion
set "mod1=mode con cols=110 lines=45&color 3F"  
set "mod2=mode con cols=80 lines=8&color 3F"  
set "auto1=*.ac3 *.avi *.drv *.flv *.mkv *.mpg *.mp2 *.ps *.trp *.ts *.wav"  
set "auto2=.ac3, .avi, .drv, .flv, .mkv, .mpg, .mp2, .ps, .trp, .ts, .wav"  
set "sDat=%tmp%\sDat.tmp"  
set "inex=A%~x1"&set "lw=O%~d1"  
%mod2%&if n%1==n goto :ende
call start-set "progs"  
if "A%inex:~1,1%"=="A." goto :run  
if "O%lw:~2,1%"=="O:" goto :auto  
goto :eof

:auto
pushd "%~1"  
set run=auto & echo "%cd%"  
FOR /r "%cd%" %%i IN (%auto1%) DO (  
	set "inPut=%%i"&color 3F  
	call :FileSet "!inPut!"  
	if "!inex:~0,1!"=="." call :process  
)
goto ende

:FileSet
%mod2% & title %~n0&echo.
if "%run%"=="auto" ping -n 5 localhost 1>nul 2>nul  
set "inPut=%~1"&set "inFile=%~dpn1"&set "inex=%~x1"  
echo  Pfad	%~dp1
echo  Datei	%~n1 & set "datnam=%~n1"  
echo  Ext	*%~x1
set "info=Echo  Habe fertig."& echo.& ping -n 5 localhost 1>nul 2>nul  
FOR %%i IN (%auto2%) DO if /I "%~x1"=="%%i" set "work=yes"&goto :eof  
goto :eof

:run
call :FileSet "%~1"  
call :process
goto ende

:process
if not "!work!"=="yes" set "info=Echo  Input-Dateiendung *%inex% ist verkehrt."&goto :eof  
cls&echo.&echo  !datnam! wird untersucht ...&echo.
%ffmpeg% -i "%input%" 2> "%sDat%"  
%mod1%&type "%sDat%"&echo.&ping -n 3 localhost 1>nul 2>nul  
%mod2%&findstr /c:"Video:" "%sDat%"  
if not errorlevel 1 set "Media=Video"&set "outex=mp4"  
if errorlevel 1 set "Media=Audio"&set "outex=mp3"  
findstr /c:"Video: none" "%sDat%"  
if not errorlevel 1 set "Media=Audio"&set "outex=mp3"  
cls&title Datei ist ein !Media!&echo.&echo  Die Suche geht weiter ...
ping -n 3 localhost 1>nul 2>nul
%mediainfo% "%Input%" > "%sDat%"  
cls & type "%sDat%"&echo.  
goto :sDatFLV
:next
title Transforming "!datnam!.!inex:~1,3!" to *.!outex!  
%mod2%&cls&echo.&echo  %time:~0,-3% Transformer started ...&echo.&ping -n 3 localhost 1>nul 2>nul
if not %2n==n set  "outex=%2" & if not %3n==n set  "parm=%~3"  
if not "%~x1"==".flv" (%ffmpeg% -i "%~1" !parm! "%~dpn1+.!outex!" 2>"%~dpn1+.txt"  
		) ELSE %mod1%& %ffmpeg% -i "%~1" !parm! "%~dpn1+.!outex!"  
:nextend
move /y "%~1" "%~dp1newMuX_%~nx1"  
move /y "%~dp1newMuX_%~nx1" "%weg%"  
move /y "%~dpn1+.!outex!" "%~dpn1.!outex!"  
if exist %mp3DirectCut%.exe if "!outex!"=="mp3" (  
	%mod2%&cls&echo.&echo  %time:~0,-3% mp3-Datei mit mp3DirectCut bearbeiten ...
	ping -n 3 localhost 1>nul 2>nul & %mp3DirectCut% "%~dpn1.!outex!"	  
	move /y "%~dpn1*.*" "%weg%"  
	)
goto :eof

:inFLV
if not "%inex%"==".flv" move /y "%input%" "%inFile%.flv"  
set "input=%inFile%.flv"& set inex=.flv  
set "parm=-vcodec copy -acodec copy"  
call :next "%input%"  
goto :eof
:inPS-TS
if /I not "%~x1"==".!ac:~-2,2!" move /y "%inPut%" "%inFile%.!ac:~-2,2!"  
set "input=%inFile%.!ac:~-2,2!"& set inex=.!ac:~-2,2!  
if /I "!ac:~-2,2!"=="TS" (set "parm=-acodec libmp3lame -sameq"  
	if /I "!bc!"=="AC-3" set "parm=-acodec copy"&set "outex=ac3"  
	) ELSE set "parm=-acodec copy"  
if "!outex!"=="ac3" (call :Raumklang "%input%" !outex!) ELSE call :next "%input%" !outex!  
goto :eof
:sDatFLV
%mod2%&findstr /c:"Flash Video" "%sDat%"  
if not errorlevel 1 color 20&title Datei ist ein Flash-!Media!&goto :inFLV
if errorlevel 1 color 1F&title Datei ist kein Flash-!Media!&cls&echo.&echo  ... suche noch weiter ... 
if "!Media!"=="Video" call :next "%input%" & goto :eof  
ping -n 5 localhost 1>nul 2>nul&cls
:sDatPS-TS
FOR /f "delims=: tokens=1-3" %%i IN ('findstr /i /n "MPEG-TS MPEG-PS" "%sDat%"') DO @set "ac=%%k"  
if not "!ac!"=="" cls&Echo.&(  
	title ...prfe noch, ob Datei ein !ac:~1,7!-!Media! ist...&cls&echo.
	echo  ... wait a minute ...&echo.
	FOR /f "delims=: tokens=1-3" %%i IN ('findstr /i /n "AC-3 MP2" "%sDat%"') DO @set "bc=%%k"  
	echo. & if not "!bc!"=="" (set bc=!bc:~1,4!&echo  Datei ist ein !bc!-!ac:~1,7!-!Media!  
	) ELSE echo  Datei ist ein !ac:~1,7!-!Media!
	echo.&goto :sDatUnknown
	)
if errorlevel 1 goto :noFLVnoTS
:sDatAC3-MP2
FOR /f "delims=: tokens=1-3" %%i IN ('findstr /i /n "AC-3 MPEG" "%sDat%"') DO @set "bc=%%k"  
echo.&if not "!bc!"=="" echo  Datei ist ein !bc:~1,4!-Audio&ping -n 5 localhost 1>nul 2>nul &(  
	if /I !bc!n==n goto :eof 
	if /I "!bc:~1,4!"=="AC-3" call :Raumklang "%input%" ac3  
	set "parm=-acodec libmp3lame -sameq"&set "outex=mp3"  
	FOR %%i IN (AC-3 MPEG) DO if /I "!bc:~1,4!"=="%%i" call :next "%input%" !outex! "!parm!"  
)
goto :eof
:sDatUnknown
%ffmpeg% -i "%input%" 2> "%sDat%"  
%mod1%&type "%sDat%"  
ping -n 5 localhost 1>nul 2>nul&cls
findstr /c:"Unknown: none" "%sDat%"  
if not errorlevel 1 goto :noFLVnoTS
if errorlevel 1 color 20&echo.&echo  Datei ist ein !ac:~1,7!-!Media!&goto :inPS-TS
:noFLVnoTS
%mod2%&echo.&echo.
title Datei ist auch kein!ac:~1,7!-!Media!&color 1F&cls&echo.
echo  Ende in Gel„nde ...&ping -n 5 localhost 1>nul 2>nul
goto :eof

:Frage
%mod2%&echo.&color FC
choice /C:nj /N /T:n,10 " %Frage% (j,n) oder in 10s automatisch ohne 5.1-Klang"  
if ERRORLEVEL 2 cls&echo.&echo  Ok, Raumklang wird benutzt.&set rklg=yes&goto :eof
if ERRORLEVEL 1 cls&echo.&echo  Ok, !datnam! wird ohne Raumklang umgewandelt.
goto :eof

:Raumklang
set "Frage=!datnam! in Raumklang umwandeln?"  
call :Frage&ping -n 5 localhost 1>NUL 2>NUL&echo.
if not "%rklg%"=="yes" goto :eof  
title Transforming "!datnam!.!inex:~1,3!" to *.%2&cls&echo.  
%mod1%&echo %time:~0,-3% Transformer started ...&echo.&ping -n 3 localhost 1>nul 2>nul
%ffmpeg% -i "%1" -vn !parm! "%~dpn1-.aac"  
%ffmpeg% -y -i "%~dpn1-.aac" -ac 6 -ar 48000 -acodec pcm_s16le -f wav - | %sox% -G --volume 2.5 -s -b 16 -c 6 -r 48000 -t raw - -t wav - | %ffmpeg% -y -i - -ab 576000 -ac 6 -ar 48000 "%~dpn1+.%2"  
del "%~dpn1-.aac"  
goto :nextend "%1" %2  

:ende
%mod2%&echo.&echo.&%Info%
ping -n 5 localhost 1>nul 2>nul
if exist "%sDat%" del "%sDat%"&exit  

Danke für das Interesse. Anregungen und Kritik sind immer gern gesehen.

max5moritz

Content-Key: 197851

Url: https://administrator.de/contentid/197851

Ausgedruckt am: 29.03.2024 um 09:03 Uhr