javacv icon indicating copy to clipboard operation
javacv copied to clipboard

FFMpeg How to seek large file (HTTP source)?

Open jershell opened this issue 2 years ago • 3 comments

I have a large file published by lighttd server and custom inputstream for buffer it and use it. Then i call the setTimestamp(ts) i got a downloading file until necessery ts position. Its a very long time. For fix it i tried call avformat_seek_file(oc, -1, offset, offset, offset, AVSEEK_FLAG_BYTE) and have partial success. but timestamp reseted and begin from zero. Also i look messages in std output

[mp3float @ 0x7f75041dc6c0] Could not update timestamps for skipped samples.
[mp3float @ 0x7f75041dc6c0] Header missing
[mp3float @ 0x7f75041dc6c0] Could not update timestamps for skipped samples.

How to seek in large files with saving ts? May i have a seek by bytes have fix missing headers?

jershell avatar Apr 16 '22 11:04 jershell

InputStream doesn't support seeking. You'll need to adjust your application such that you can use a URL directly with FFmpeg.

saudet avatar Apr 16 '22 12:04 saudet

InputStream doesn't support seeking. You'll need to adjust your application such that you can use a URL directly with FFmpeg.

I have my own implementation of InputStream with mark\reset support.

jershell avatar Apr 16 '22 13:04 jershell

The problem is that the interface of InputStream doesn't allow to seek. It cannot be done, you cannot use InputStream to do seeking. You will need to find another way of doing what you need to do. It will not work with any implementation of InputStream that you can think of because it doesn't have the interface to perform seeking operations.

saudet avatar Apr 26 '22 00:04 saudet