如何使用连续搜寻进行编码(ffmpeg x264) [英] How to encode (ffmpeg x264) with continuous seek

查看:56
本文介绍了如何使用连续搜寻进行编码(ffmpeg x264)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,可将视频文件从源"文件夹编码为目标"文件夹.

I have a batch file that encodes video files from 'Source' folder to 'Target' folder.

批处理文件的内容为:

对于("Source *.*")中的%% a

执行@echo DirectShowSource("%% a")>>"batchScript.avs"&&@echo MSharpen(10,120)>>"batchScript.avs"&&ffmpeg -i"batchScript.avs" -n -c:v libx264 -crf 24 -c:a libmp3lame -b:a 192k"Target \ %%〜na.mp4"&&del"batchScript.avs"暂停

for %%a in ("Source*.*") do @echo DirectShowSource("%%a") >> "batchScript.avs" && @echo MSharpen(10,120) >> "batchScript.avs" && ffmpeg -i "batchScript.avs" -n -c:v libx264 -crf 24 -c:a libmp3lame -b:a 192k "Target\%%~na.mp4" && del "batchScript.avs" pause

我不确定为什么,但是当我在媒体播放器经典版中播放编码文件时,我只能跳转到离散的时间,而不能跳转到单击的确切时间.

I'm not sure why, but when I playback the encoded files in media player classic I can only jump to discrete jumps in time and not to the exact time I clicked on.

该怎么办才能避免这种情况发生?

What can be done so this doesn't happen?

谢谢!

推荐答案

Media Player Classic在 View>中有一个名为 Fast Seek 的选项.选项>调整(默认情况下已启用).为了快速起见,此选项使MPC仅搜索关键帧.

Media Player Classic has an option named Fast Seek in View > Options > Tweaks which is enabled by default. For the sake of rapidity this options makes MPC seek only to keyframes.

关键帧(或I帧)不需要其他视频帧即可进行解码,但是它们的可压缩性最低(又是文件大小/流比特率在很多关键帧下都会更大).

Keyframes (or I-frames) don't need other video frames in order to be decoded, but they are the least compressible (aka the file size/stream bitrate will be larger with a lot of keyframes).

libx264 的默认关键帧间隔为250(帧),最小关键帧间隔为25.例如,以每秒25帧的速度,这意味着每250/25 = 10秒就有一个关键帧,或者更少.

The default keyframe interval for libx264 is 250 (frames) and the minimum keyframe interval is 25. At 25 frames per second, for example, this means a keyframe every 250/25=10 seconds or less.

当然,如果在MPC中启用了快速查找,这将使查找变得困难.

Of course this will make seeking difficult if fast seek is enabled in MPC.

要减少关键帧间隔,可以使用 -g [size] 或使用x264选项 keyint = [size] 指定GOP大小.

To reduce the keyframe interval you can either specify a GOP size using -g [size] or by using the x264 option keyint=[size].

例如:对于25 fps和GOP大小75,每个最大帧数都有一个关键帧.3秒.

Eg: for 25 fps and a GOP size 75 there is a keyframe every max. 3 seconds.

这篇关于如何使用连续搜寻进行编码(ffmpeg x264)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆