- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用以下脚本,我可以将文本文件中的多个视频文件连接到单个视频。
现在我想在输出视频中显示每个源视频文件的单独名称。
这是我的源 videoList.txt 文件的示例,其中包含文件名和文件路径
# videoList.txt
file 'C:\video_0020.mp4'
file 'C:\video_0040.mp4'
file '..'
@ECHO off
SETLOCAL
SET ffmpeg=C:\ffmpeg\bin
SET inFile=-f concat -i C:\videoList.txt
SET outFile=C:\output.mov
SET codec=-r 24 -vcodec mjpeg -q:v 6
REM videoFilter/filterComplex
SET filterComplex=drawtext=fontfile='C\:\\Windows\\Fonts\\arial.ttf': text='%%{filenameOfEachVideo}'
REM bring it all together
SET commandline=%ffmpeg%\ffmpeg.exe %inFile% -filter_complex "%filterComplex%" %codec% %outFile%
REM execute command
%commandline%
最佳答案
这是一个工作示例。请在使用前检查路径和文件扩展名。
我添加了很多评论,以使脚本的作用更加清晰。随意使用和修改。
@ECHO off
SETLOCAL
SETLOCAL EnableDelayedExpansion
REM path to ffmpeg
SET ffmpeg=C:\path\to\ffmpeg\bin
REM source movies from
SET movieSource=C:\path\to\your\mp4\movies
REM tmp dir
SET tmpDir=C:\path\for\tmp\files\and\final\output
REM setup positon, color, background, font for the text overlays
REM filterComplex, quotes have to be escaped! -> \"
REM BITC - Burned In Time Code
SET filterComplexTimecode=drawtext=fontfile='C\:\\Windows\\Fonts\\arial.ttf': timecode='10\:00\:00\:00': timecode_rate=24: x=(w-tw)/2: y=h-(1*lh)-3: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4
REM Date
SET filterComplexDate=drawtext=fontfile='C\:\\Windows\\Fonts\\arial.ttf': text='%%{localtime\: %%d.%%m.%%Y %%H\\\:%%M}': x=(w-tw-3): y=h-(1*lh)-3: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4
REM Shotname
SET filterComplexShotname=drawtext=fontfile='C\:\\Windows\\Fonts\\arial.ttf': x=0: y=h-(1*lh)+1: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4:
REM create a list of all files
FOR /F "tokens=*" %%F IN ('dir %movieSource%\*.mp4 /b ^| sort') DO ECHO file '%movieSource%\%%F' >> %tmpDir%\filelist.txt
REM gather more informations for each file
ECHO ; filename, durationInSeconds > %tmpDir%\fileNameDuration.txt
FOR /R %movieSource%\ %%F IN (*.mp4) DO (
REM Reset current duration to 0 (zero) for each loop
SET curDuration=0
REM get the filename without file extenion
SET fileName=%%~nF
REM get the duration of a single clip
REM and write it to a tmp textfile
%ffmpeg%\ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 %%~fF > %tmpDir%\fileTempDuration.txt
REM read the textfile again into a variable
SET /p curDuration=<%tmpDir%\fileTempDuration.txt
REM write the filename and the duration to a new list of all files
ECHO !fileName!,!curDuration! >> %tmpDir%\fileNameDuration.txt
)
REM concate a filter complex string for ffmpeg with all clipnames as textlayer with a inpoint and outpoint
SET filterComplexShotnameCombined=
REM floating numbers are not supported by batch, so we need to work-around that
CALL :IntAsFP b=0.000000
FOR /F "eol=; tokens=1,2* delims=," %%i IN (%tmpDir%\fileNameDuration.txt) DO (
CALL :IntAsFP a=%%j
CALL :IntToFP inPoint=!b! 6
SET /A c=a+b
SET /A b=c
CALL :IntToFP outPoint=!c! 6
REM just to check whats going on...
ECHO name: %%i duration: %%j inPoint: !inPoint! outPoint: !outPoint!
SET filterComplexShotnameCombined=!filterComplexShotnameCombined!, !filterComplexShotname! text=%%i: enable=between(t\,!inPoint!\,!outPoint!^^^)
)
REM bringing all together. filter complex for current date, one for the normal timecode, and the actual shotnames.
SET filterComplexCombined=-filter_complex "%filterComplexDate%, %filterComplexTimecode% %filterComplexShotnameCombined%"
REM just to check...
ECHO %filterComplexCombined%
%ffmpeg%\ffmpeg.exe %async% -f concat -i %tmpDir%\filelist.txt %filterComplexCombined% %fps% %codec% %loglevel% %tmpDir%\output.mov
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Integer to FloatingPoint
:IntAsFP Int=FP
set FP=%2
set %1=%FP:.=%
exit /B
:IntToFP FP=Int digits
set Int=%2
set %1=!Int:~0,-%3!.!Int:~-%3!
exit /B
关于video - ffmpeg 与 -i concat filelist.txt 中不同文件的 drawtext 文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33128639/
数据库设置: http://sqlfiddle.com/#!2/4d1c2/1 以下查询选择属于productID的所有标签及其位置,逗号分隔: SELECT CONCAT_WS(',', GROUP
要连接两个文件,它看起来像这样: concat: { src: ['common.js','js/app.js'], dest: 'assets/js/app.js' } 如果
我有一个执行 SQL 脚本的 PDI(Kettle)转换,脚本的输出是一列,如下所示: val1 val2 val3 val4 "more values"... 我需要像这样在一个 Excel 单元格
我正在尝试传递一个参数 [例如@X nvarchar(MAX)] 转换成变量 [例如@message nvarchar(MAX)] 在存储过程中。该变量使用 CONCAT 组合字符串值和变量,它最终成
我不知道如何解释我的问题... 这是我的sql请求: SELECT DISTINCT CONCAT (nompropre, ' ', Auteur, ' de ', localite) AS aute
如何在与另一个表连接的表中使用 concat 和 group concat。架构如下所示: 第一表: MariaDB [ittresnamuda]> select * from tb_tipe_req
在我的 CREATE VIEW 中,我想: SELECT CONCAT( t.str1, t.str2 ) AS Title, CHAR_LENGTH( Title ) AS Length 但这会产生
我正在使用 CriteriaBuilder.concat 连接 2 个字符串,代码如下: Expression concat = criteriaBuilder.concat(expr1, expr2
我有以下继承 IEnumerable 的类 public class LinesEnumerable : IEnumerable { protected readonly IPointSeri
_.concat 和有什么区别lodash 和 Array.prototype.concat() ?. 最佳答案 欢迎来到 Stackoverflow! 这些函数的工作方式相同,但语法不同: _.co
我有一个非常大的表(几百万条记录)。表中的列 A 目前是这样的:id、道路名称、纬度、经度,其中 id 是自动增量 PK。 目前,1 个道路名称可以在表中包含多个条目,因为每条道路都映射到多个(纬度、
我测试了各种数组连接技术,并不是因为它实际上对我的代码很重要,而只是顺便说一句,看看我们现在在哪里。正如预期的那样,非常新的 ES 2015 传播运算符在 JavaScript 数组上被旧的 conc
我有一个数组,我需要使用一些编辑重新编译。我是在 async.concat() 的帮助下完成的,但有些东西不起作用。告诉我,哪里错了? async.concat(dialogs, function(d
在 JavaScript 中,我遇到过以两种主要方式编写的代码,用于连接两个(或更多)使用 .concat() 的数组。 Array 上的方法目的。 (假设在下文中,arr1 和 arr2 是作为 .
我之前曾使用 stack over flow 来解决我的 sql 问题并且成功了。 这一次我的下一期可能不会那么成功。 我有一个名为 Statements_1 的表,该表大约有 50 列,假设有 10
我在想以一种相当奇怪的方式从数据库获取东西时遇到了一些麻烦。假设我有下一张 table ID | Rating 229 | 3 229 | 2 229 | 4 229 | 2 2
我有类似表中的内容 mysql> select uuid , short-uuid FROM sampleUUID WHERE identifier ="test123"; +------------
我有一个查询,用于获取我离开加入两个表的帖子: 类别和标签:LEFT JOIN 到链接表→‖INNER JOIN 到类别和标签名称表。 LEFT JOIN wp_term_relationships
我目前正在开发一个大型 angular.js 项目。我使用 grunt 将所有文件合并/丑化为一个大的 target.js 文件,然后将其包含在索引页中。 我已经意识到,这使得在开发环境中调试变得非常
我的表中有三列:firstName、lastName 和 jobTitle。我想将 firstName 和 lastName 连接为 Fullname,然后连接 Fullname 和 jobTitle
我是一名优秀的程序员,十分优秀!