patui / Nosub

C++ Subtitle Editor (全新C++字幕软件,https://www.nosub.cn)
234 stars 23 forks source link

视频压制失败的问题分析; #26

Closed patui closed 3 years ago

patui commented 3 years ago

FFmpeg Log日志: `[Parsed_ass_0 @ 000002580dd21b00] ass_read_file(C:\Users\濮滃浗鍚沑AppData\Local\Temp\2021_03_31_09_53_47_941.ass): fopen failed [Parsed_ass_0 @ 000002580dd21b00] Could not create a libass track when reading file 'C:\Users\濮滃浗鍚沑AppData\Local\Temp\2021_03_31_09_53_47_941.ass' [AVFilterGraph @ 000002581039a7c0] Error initializing filter 'ass' with args ''C:\Users\濮滃浗鍚沑AppData\Local\Temp\2021_03_31_09_53_47_941.ass''

Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0

Conversion failed!`

通过分析: 应该是ASS路径和编码格式导致的问题;

可以参考这样的压缩格式: ffmpeg -i D:/TempDemo/AC99.mp4 -vcodec libx264 -filter_complex subtitles='C\:/ProgramData/AC99.ass:charenc=UTF-8' -y D:/TempDemo/Test_Video/UP_video/AC99_H264.mp4

上面省略了部分压制参数;

Windows下使用的是反斜杠"\"。

Linux下使用的是正斜杠"/"

另外注意ASS路径在单引号之间,而且盘符的冒号前面要加转移符\,非UTF-8编号,通过charenc=UTF-8强制转换为UTF-8格式;