How to encode (ffmpeg x264) with continuous seek

你说的曾经没有我的故事 提交于 2019-12-11 22:08:36

问题


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

The batch file content is:

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?

Thanks all!


回答1:


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.

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).

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.

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

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

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



来源:https://stackoverflow.com/questions/29580912/how-to-encode-ffmpeg-x264-with-continuous-seek

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!