为什么批量工作没有第二次通话?

时间:2013-10-12 05:25:50

标签: batch-file

我有以下使用

从另一个调用的批处理脚本
cmd /c 1getthumbs @file > log.txt

1getthumbs的内容是:

set initFile=%1
echo.%initFile%
set out=%initFile:.mts=-a.jpg%
rem echo.%out%

ffmpeg32 -ss 00:00:30 -i "C:\Users\s\Desktop\social\\%1" -frames:v 1 
"C:\Users\s\Desktop\social\thumbs\\%out%"

set out=%initFile:.mts=-b.jpg%
echo.%out%

ffmpeg32 -ss 00:01:00 -i "C:\Users\s\Desktop\social\\%1" -frames:v 1 
"C:\Users\s\Desktop\social\thumbs\%out%"

以下执行第一个ffmpeg32但不执行第二个ffmpeg32 任何想法为什么?

测试时使用log.txt内容进行更新:

C:\Program Files\ffmpeg>set initFile="00178.MTS" 

C:\Program Files\ffmpeg>echo."00178.MTS"
"00178.MTS"

C:\Program Files\ffmpeg>set out="00178-a.jpg" 

C:\Program Files\ffmpeg>rem echo."00178-a.jpg" 

C:\Program Files\ffmpeg>ffmpeg32 -ss 00:00:30 -i "C:\Users\s\Desktop\social\\"00178.MTS"" -frames:v 1 "C:\Users\s\Desktop\social\thumbs\\"00178-a.jpg"" 

这是我执行调用1getthumbs.bat

的批处理文件时的输出
C:\Program Files\ffmpeg>cmd /c 1getthumbs "00178.MTS" > log.txt
ffmpeg version N-52045-g694fa00 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 12 2013 16:54:51 with gcc 4.8.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrn
b --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libr
tmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo
ra --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
ble-zlib
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 53.101 /  3. 53.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'C:\Users\s\Desktop\social\00178.MTS':
  Duration: 00:00:02.51, start: 1.000011, bitrate: 24725 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: h264 (High) (HDPR / 0x52504448), yuv420p, 1920x1
080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp,
 256 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Output #0, image2, to 'C:\Users\s\Desktop\social\thumbs\00178-a.jpg':
  Metadata:
    encoder         : Lavf55.2.100
    Stream #0:0: Video: mjpeg, yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2
00 kb/s, 90k tbn, 59.94 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[h264 @ 03598580] Missing reference picture, default is 0
[h264 @ 03598580] decode_slice_header error
[h264 @ 03598580] Missing reference picture, default is 0
[h264 @ 03598580] decode_slice_header error
[h264 @ 03598580] Missing reference picture, default is 0
[h264 @ 03598580] decode_slice_header error
[h264 @ 03598580] Missing reference picture, default is 0
[h264 @ 03598580] decode_slice_header error
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead -inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters i
f used)

1 个答案:

答案 0 :(得分:0)

试试这个:它用引号和斜线修正了一些问题 如果ffmpeg32是批处理文件,则需要使用call ffmpeg32

set "initFile=%~1"
echo."%initFile%"
set "out=%initFile:.mts=-a.jpg%"
rem echo."%out%"

ffmpeg32 -ss 00:00:30 -i "C:\Users\s\Desktop\social\%initFile%" -frames:v 1 "C:\Users\s\Desktop\social\thumbs\%out%"

set "out=%initFile:.mts=-b.jpg%"
echo."%out%"

ffmpeg32 -ss 00:01:00 -i "C:\Users\s\Desktop\social\%initFile%" -frames:v 1 "C:\Users\s\Desktop\social\thumbs\%out%"