3

Я пытаюсь конвертировать некоторые .webm файл в mp4. В графическом интерфейсе я выбираю следующие настройки для конвертации:

Видео:

  • Кодек: H-264
  • Элемент списка
  • Битрейт: 512 кб / с
  • Частота кадров: 23,97 кадров в секунду
  • Масштаб: 1

Аудио:

  • Кодек: MPEG 4 Audio (AAC)
  • Битрейт: 128 кб / с
  • Каналы: 2
  • Частота дискретизации: 44100

И это сработало отлично. Теперь я хотел конвертировать все мои видеофайлы webm в mp4 в пакетном режиме. Поэтому я пробую этот пакетный скрипт (в основном, взятый из вики-страницы VLC)


@echo off
FOR /R %%G IN (*.webm) DO (CALL :SUB_VLC "%%G")
GOTO :eof

:SUB_VLC
 SET _firstbit=%1
 SET _qt="
 CALL SET _newnm=%%_firstbit:%_qt%=%%
 SET _commanm=%_newnm:,=_COMMA_%
 echo %_commanm%
 CALL "C:\Program Files (x86)\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{vcodec="h264", vb="512", fps="23.97", scale="1", acodec="mpga",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux="dummy",dst="%_commanm%.mp4"} vlc://quit
GOTO :eof

:eof

Но это не похоже на работу (то есть я не получаю никакого вывода). Вместо этого я получаю эти сообщения в фиктивном окне vlc:


[023332fc] dummy interface: VLC media player - 1.1.11 The Luggage
[023332fc] dummy interface: Copyright © 1996-2011 the VideoLAN team
[023332fc] dummy interface:
Warning: if you can't access the GUI anymore, open a command-line window, go to
the directory where you installed VLC and run "vlc -I qt"

[023332fc] dummy interface: using the dummy interface module...
[023332fc] main interface debug: using interface module "dummy"
[023332fc] main interface debug: TIMER module_need() : 45.000 ms - Total 45.000
ms / 1 intvls (Avg 45.000 ms)
[02315e04] main playlist debug: rebuilding array of current - root Playlist
[02315e04] main playlist debug: rebuild done - 5 items, index -1
[02315e04] main playlist debug: processing request item null node Playlist skip
0
[02315e04] main playlist debug: starting new item
[02315e04] main playlist debug: creating new input thread
[022ffbe4] main input debug: Creating an input for 'a.webm'
[022ffbe4] main input debug: thread (input) created at priority 1 (../.././src/i
nput/input.c:220)
[022ffbe4] main input debug: thread started
[02343144] main stream output debug: using sout chain=`transcode{vcodec=h264,'
[02343144] main stream output debug: stream=`transcode'
[023400dc] main stream out debug: looking for sout stream module: 1 candidate
[023400dc] stream_out_transcode stream out error: cannot create chain
[023400dc] main stream out debug: no sout stream module matching "transcode" cou
ld be loaded
[023400dc] main stream out debug: TIMER module_need() : 5.000 ms - Total 5.000 m
s / 1 intvls (Avg 5.000 ms)
[023400dc] main stream out debug: destroying chain... (name=(null))
[023400dc] main stream out debug: destroying chain done
[02343144] main stream output error: stream chain failed for `transcode{vcodec=h
264,'
[022ffbe4] main input error: cannot start stream output instance, aborting
[02315e04] main playlist debug: finished input
[022ffbe4] main input debug: thread ended
[02315e04] main playlist debug: dead input
[022ffbe4] main input debug: thread times: real 0m0.015000s, kernel 0m0.000000s,
 user 0m0.000000s
[022ffbe4] main input debug: TIMER input launching for 'a.webm' : 15.000 ms - To
tal 15.000 ms / 1 intvls (Avg 15.000 ms)
[02315e04] main playlist debug: changing item without a request (current 0/5)
[02315e04] main playlist debug: using item 1
[02315e04] main playlist debug: starting new item
[02315e04] main playlist debug: creating new input thread
[022ffbe4] main input debug: Creating an input for 'New Folder/vb=512,'
[022ffbe4] main input debug: thread started
[022ffbe4] main input debug: thread (input) created at priority 1 (../.././src/i
nput/input.c:220)
[02343204] main stream output debug: using sout chain=`transcode{vcodec=h264,'
[02343204] main stream output debug: stream=`transcode'
[02340194] main stream out debug: looking for sout stream module: 1 candidate
[02340194] stream_out_transcode stream out error: cannot create chain
[02340194] main stream out debug: no sout stream module matching "transcode" cou
ld be loaded
[02340194] main stream out debug: TIMER module_need() : 5.000 ms - Total 5.000 m
s / 1 intvls (Avg 5.000 ms)
[02340194] main stream out debug: destroying chain... (name=(null))
[02340194] main stream out debug: destroying chain done
[02343204] main stream output error: stream chain failed for `transcode{vcodec=h
264,'
[022ffbe4] main input error: cannot start stream output instance, aborting
[02315e04] main playlist debug: finished input
[022ffbe4] main input debug: thread ended
[02315e04] main playlist debug: dead input
[022ffbe4] main input debug: thread times: real 0m0.030000s, kernel 0m0.000000s,
 user 0m0.000000s
[022ffbe4] main input debug: TIMER input launching for 'New Folder/vb=512,' : 30
.000 ms - Total 30.000 ms / 1 intvls (Avg 30.000 ms)
[02315e04] main playlist debug: changing item without a request (current 1/5)
[02315e04] main playlist debug: using item 2
[02315e04] main playlist debug: starting new item
[02315e04] main playlist debug: creating new input thread
[022ffbe4] main input debug: Creating an input for 'New Folder/fps=23.97,'
[022ffbe4] main input debug: thread (input) created at priority 1 (../.././src/i
nput/input.c:220)
[022ffbe4] main input debug: thread started
[02343144] main stream output debug: using sout chain=`transcode{vcodec=h264,'
[02343144] main stream output debug: stream=`transcode'
[02315e04] main playlist debug: meta ok for (null), need to fetch art
[0231871c] main stream out debug: looking for sout stream module: 1 candidate
[02cd3b5c] main demux meta debug: looking for meta fetcher module: 1 candidate
[0231871c] stream_out_transcode stream out error: cannot create chain
[02cd3b5c] lua demux meta debug: Trying Lua scripts in C:\Users\mmz\AppData\Roam
ing\vlc\lua\meta\fetcher
[0231871c] main stream out debug: no sout stream module matching "transcode" cou
ld be loaded
[02cd3b5c] lua demux meta debug: Trying Lua scripts in C:\Program Files (x86)\Vi
deoLAN\VLC\lua\meta\fetcher
[0231871c] main stream out debug: TIMER module_need() : 0.000 ms - Total 0.000 m
s / 1 intvls (Avg 0.000 ms)
[0231871c] main stream out debug: destroying chain... (name=(null))
[02cd3b5c] lua demux meta debug: Trying Lua playlist script C:\Program Files (x8
6)\VideoLAN\VLC\lua\meta\fetcher\tvrage.lua
[0231871c] main stream out debug: destroying chain done
[02343144] main stream output error: stream chain failed for `transcode{vcodec=h
264,'
[02cd3b5c] main demux meta debug: using meta fetcher module "lua"
[022ffbe4] main input error: cannot start stream output instance, aborting
[02315e04] main playlist debug: finished input
[02cd3b5c] main demux meta debug: TIMER module_need() : 5.000 ms - Total 5.000 m
s / 1 intvls (Avg 5.000 ms)
[022ffbe4] main input debug: thread ended
[02315e04] main playlist debug: dead input
[02cd3b5c] main demux meta debug: removing module "lua"
[022ffbe4] main input debug: thread times: real 0m0.010000s, kernel 0m0.000000s,
 user 0m0.000000s
[02315e04] main playlist debug: searching art for a.webm
[022ffbe4] main input debug: TIMER input launching for 'New Folder/fps=23.97,' :
 15.000 ms - Total 15.000 ms / 1 intvls (Avg 15.000 ms)
[02315e04] main playlist debug: changing item without a request (current 2/5)
[022c74d4] main art finder debug: looking for art finder module: 2 candidates
[02315e04] main playlist debug: using item 3
[022c74d4] lua art finder debug: Trying Lua scripts in C:\Users\mmz\AppData\Roam
ing\vlc\lua\meta\art
[02315e04] main playlist debug: starting new item
[022c74d4] lua art finder debug: Trying Lua scripts in C:\Program Files (x86)\Vi
deoLAN\VLC\lua\meta\art
[02315e04] main playlist debug: creating new input thread
[022c74d4] lua art finder debug: Trying Lua playlist script C:\Program Files (x8
6)\VideoLAN\VLC\lua\meta\art\01_googleimage.lua
[022ffbe4] main input debug: Creating an input for 'New Folder/scale=1,'
[022c74d4] lua art finder debug: Trying Lua playlist script C:\Program Files (x8
6)\VideoLAN\VLC\lua\meta\art\02_frenchtv.lua
[022ffbe4] main input debug: thread (input) created at priority 1 (../.././src/i
nput/input.c:220)
[022ffbe4] main input debug: thread started
[022c74d4] lua art finder debug: Trying Lua playlist script C:\Program Files (x8
6)\VideoLAN\VLC\lua\meta\art\03_lastfm.lua
[02ca2f6c] main stream output debug: using sout chain=`transcode{vcodec=h264,'
[02ca2f6c] main stream output debug: stream=`transcode'
[022c74d4] lua art finder debug: Trying Lua playlist script C:\Program Files (x8
6)\VideoLAN\VLC\lua\meta\art\04_musicbrainz.lua
[023187d4] main stream out debug: looking for sout stream module: 1 candidate
[023187d4] stream_out_transcode stream out error: cannot create chain
[022c74d4] main art finder debug: no art finder module matching "any" could be l
oaded
[023187d4] main stream out debug: no sout stream module matching "transcode" cou
ld be loaded
[022c74d4] main art finder debug: TIMER module_need() : 10.000 ms - Total 10.000
 ms / 1 intvls (Avg 10.000 ms)
[02315e04] main playlist debug: art not found for a.webm
[023187d4] main stream out debug: TIMER module_need() : 10.000 ms - Total 10.000
 ms / 1 intvls (Avg 10.000 ms)
[023187d4] main stream out debug: destroying chain... (name=(null))
[023187d4] main stream out debug: destroying chain done
[02ca2f6c] main stream output error: stream chain failed for `transcode{vcodec=h
264,'
[022ffbe4] main input error: cannot start stream output instance, aborting
[02315e04] main playlist debug: finished input
[022ffbe4] main input debug: thread ended
[02315e04] main playlist debug: dead input
[022ffbe4] main input debug: thread times: real 0m0.015000s, kernel 0m0.000000s,
 user 0m0.015600s
[022ffbe4] main input debug: TIMER input launching for 'New Folder/scale=1,' : 1
5.000 ms - Total 15.000 ms / 1 intvls (Avg 15.000 ms)
[02315e04] main playlist debug: changing item without a request (current 3/5)
[02315e04] main playlist debug: using item 4
[02315e04] main playlist debug: starting new item
[02315e04] main playlist debug: creating new input thread
[022ffbe4] main input debug: Creating an input for 'a.webm.mp4}'
[022ffbe4] main input debug: thread (input) created at priority 1 (../.././src/i
nput/input.c:220)
[022ffbe4] main input debug: thread started
[02ca302c] main stream output debug: using sout chain=`transcode{vcodec=h264,'
[02ca302c] main stream output debug: stream=`transcode'
[02cc8c24] main stream out debug: looking for sout stream module: 1 candidate
[02cc8c24] stream_out_transcode stream out error: cannot create chain
[02cc8c24] main stream out debug: no sout stream module matching "transcode" cou
ld be loaded
[02cc8c24] main stream out debug: TIMER module_need() : 0.000 ms - Total 0.000 m
s / 1 intvls (Avg 0.000 ms)
[02cc8c24] main stream out debug: destroying chain... (name=(null))
[02cc8c24] main stream out debug: destroying chain done
[02ca302c] main stream output error: stream chain failed for `transcode{vcodec=h
264,'
[022ffbe4] main input error: cannot start stream output instance, aborting
[02315e04] main playlist debug: finished input
[022ffbe4] main input debug: thread ended
[02315e04] main playlist debug: dead input
[022ffbe4] main input debug: thread times: real 0m0.015000s, kernel 0m0.015600s,
 user 0m0.000000s
[022ffbe4] main input debug: TIMER input launching for 'a.webm.mp4}' : 15.000 ms
 - Total 15.000 ms / 1 intvls (Avg 15.000 ms)
[02315e04] main playlist debug: changing item without a request (current 4/5)
[02315e04] main playlist debug: nothing to play

Что я делаю неправильно?

2 ответа2

3

Я делаю ответ из своего комментария, я думаю, что это является причиной вашей проблемы.

В вашем скрипте вы используете

 CALL "C:\Program Files (x86)\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{vcodec="h264", vb="512", fps="23.97", scale="1", acodec="mpga",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux="dummy",dst="%_commanm%.mp4"} vlc://quit

и ошибка показывает

main stream output error: stream chain failed for `transcode{vcodec=h264,'

это приводит меня к выводу, что синтаксический анализатор режет все пробелы (пробел, табуляция и т. д.) и, следовательно, не может понять команду. В ссылке на вики VLC также нет пробелов.

попробуйте эту строку:

CALL "C:\Program Files (x86)\VideoLAN\VLC\vlc" -I dummy -vvv %1 --sout=#transcode{vcodec="h264",vb="512",fps="23.97",scale="1",acodec="mpga",ab="128","channels=2",samplerate="44100"}:standard{access="file",mux="dummy",dst="%_commanm%.mp4"} vlc://quit

Почему VLC не может справиться с этими глупыми пробелами, которые вы можете спросить? (на самом деле вы делаете;))

Когда программа вызывается для выполнения ОС - я знаю это только для linux, но я почти уверен, что Windows обрабатывает ее очень похоже - параметры команды разделяются операционной системой (в пробелах), а затем передается программе в виде списка, каждый из которых содержит только содержимое между пробелами.

Таким образом, задачей программы будет распознать и прочитать все отдельные записи в этом списке и снова склеить их, это действительно возможно, но требует времени, как при разработке программного обеспечения, так и при оценке параметров.

0

Чтобы конвертировать .mod файлы моей видеокамеры в .m4v, в Linux я написал этот скрипт

#!/bin/sh
NAME=`echo "$1" | cut -d'.' -f1`
vlc $1 -I dummy --play-and-exit --sout='#transcode{vcodec=h264,acodec=mp4a,ab=128,samplerate=44100,deinterlace,audio-sync}:std{access=file, mux=mp4,dst=./'"$NAME"'.m4v}

который я дал названию mod2h264.sh и сделал исполняемым.

Затем в командной строке просто введите

for file in *.MOD; do ~/MyScripts/mod2h264.sh "$file"; done

и вы все конвертируете.MOD файлы в текущем каталоге. Вы можете настроить параметры в соответствии с желаемым выходом.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .