[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 视频截图分割的批处理出现了could not find ref with poc 24如何解决

rt,在用批处理进行视频截图分割的时候出现了这个问题,而且截取出来的图像是灰色的
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set index=0
  4. for %%f in (*.mp4) do (
  5.     set files[!index!]=%%~nf
  6.     echo !index!. %%~nf
  7.     set /a index+=1
  8. )
  9. set /p select_index=Select:
  10.     for /l %%i in (!select_index!, 1, !select_index!) do (
  11.         if defined files[%%i] (
  12.             call :cut_mp4 !files[%%i]!
  13.         )
  14.     )
  15. exit /b 0
  16. :convert_mp4
  17. ffmpeg -i %~1.mp4 ^
  18.        -c:a copy ^
  19.        -c:v hevc_nvenc ^
  20.        -vf scale=1920:-1 ^
  21.        -preset slow ^
  22.        -crf 20 ^
  23.        output/%~1.mp4
  24. exit /b 0
  25. :cut_mp4
  26. md output\%~1
  27. for /f "tokens=2 delims=, " %%a in ('ffmpeg -i %~1.mp4 2^>^&1 ^| find "Duration:"') do (
  28.     set duration=%%a
  29.     set /a duration_seconds=!duration:~0,2!*3600+!duration:~3,2!*60+!duration:~6,2!
  30.     set /a frames=!duration_seconds!/30
  31. )
  32. for /l %%j in (1, 1, !frames!) do (
  33.     set /a hours=%%j/120
  34.     if !hours! lss 10 (set hours=0!hours!)
  35.     set /a minutes=%%j/2-!hours!*60
  36.     if !minutes! lss 10 (set minutes=0!minutes!)
  37.     set /a seconds=%%j*30-!hours!*3600-!minutes!*60
  38.     if !seconds! lss 10 (set seconds=0!seconds!)
  39.     set times=!hours!:!minutes!:!seconds!
  40.     ffmpeg -loglevel error ^
  41.            -ss !times! ^
  42.            -i %~1.mp4 ^
  43.            -f image2 ^
  44.            -frames:v 1 ^
  45.            -q:v 1 ^
  46.            output/%~1/!hours!_!minutes!_!seconds!-0.jpg
  47. )
  48. exit /b 0
  49. pause
复制代码

回复 1# wip


这不是BAT语法报错,而是ffmpeg在报错。

请参考Q-01观察一下哪行代码在报错以及详细的报错信息:
https://mp.weixin.qq.com/s/Koje4FufWxWBs7ioDy_LJA

然后调整那一行的ffmpeg参数。
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 2# Batcher


    好的,谢谢您,刚刚按照您说的进行了修改,但是好像还是没有具体位置,那个结果出来就是一连串的
[hevc @ 0001232360a58900] Could not find ref with POC24
[hevc @ 数字] Could not find ref with POC23
[hevc @ 数字] Could not find ref with POC22
[hevc @ 数字] Could not find ref with POC22

TOP

返回列表