Questions tagged [seek]

Seeking is the act of moving around a file or file-like object.

Seeking is the act of moving around a file or file-like object.

ANSI C in section 2.3.12.10 specifies thatfseek has the argument structure:

int fseek(FILE *stream, long offset, int whence);

Where:

  • stream is the FILE object to seek (note that this does not have to physically be a file)
  • offset is how much, relative to the whence argument
  • whence is one of
    • SEEK_SET (offset is computed relative to the start of the file)
    • SEEK_CUR (offset is computed relative to the current position)
    • SEEK_END (offset is computed relative to the end of the file)

The majority of languages based upon C, and even many that aren't, have inherited something similar to fseek, but have probably put it somewhere else (ex. Python's file.seek). Check your language of choice's documentation for details.

537 questions
9
votes
3 answers

Send seek command to running ffmpeg instance

I have created a video player using the ffmpeg libraries, but want to know if the same is possible using ffmpeg.exe and piping, specifically the seeking part. Is it possible to send seek command to a running ffmpeg.exe instance? Such a command is…
Mike Versteeg
  • 1,615
  • 14
  • 28
9
votes
2 answers

How to detect MPMoviePlayerController starts a movie?

I am using MPMoviePlayerController, how do I detect when the movie actually started playing - as opposed to when the user fiddles with the seek controls? From the tests I made, I always get a "load state change" event and (moviePlayer.loadState ==…
9
votes
2 answers

seek() a file within a zip file in Python without passing it to memory

is there anyway to make a file inside a zip file seekable in Python without reading it to memory? I tried the obvious procedure but I get an error since the file is not seekable: In [74]: inputZipFile =…
jbssm
  • 6,861
  • 13
  • 54
  • 81
8
votes
1 answer

About the use of seek on gzip files

I have a big gzip file and I would like to read only parts of it using seek. About the use of seek on gzip files, this page says: The seek() position is relative to the uncompressed data, so the caller does not even need to know that the data…
usual me
  • 8,338
  • 10
  • 52
  • 95
8
votes
5 answers

Seek a specific record in MySQL paged results

I've a classic pagination system using LIMIT startrecord, endrecord and I want to figure out in what page number an X record is located. The only idea I've right now is to seek recursively all the records to find it out. But I'm looking for a much…
Lwyrn
  • 1,821
  • 1
  • 16
  • 27
7
votes
2 answers

Seek on a large text file python

I have a few text files whose sizes range between 5 gigs and 50 gigs. I am using Python to read them. I have specific anchors in terms of byte offsets, to which I can seek and read the corresponding data from each of these files (using Python's file…
khan
  • 7,005
  • 15
  • 48
  • 70
7
votes
3 answers

Processing large files in chunks: inconsistent seek with readline

I am trying to read and process a large file in chunks with Python. I am following this blog that proposes a very fast way of reading and processing large chunks of data spread over multiple processes. I have only slightly updated the existing code,…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
7
votes
3 answers

How to seek() then pause() with JWPlayer 5.4

Does anyone know how to get JW PLayer v5.4 (either the Flash rendering or the HTML5 rendering) to pause after a seek() command? I'm trying to get the video to step 0.01 seconds forward or backward when a user clicks the fine-grain control buttons…
AJB
  • 7,389
  • 14
  • 57
  • 88
7
votes
1 answer

fs.createReadStream() at specific position of file

Is it possible to create a stream that reads from a specific position of file in node.js? I know that I could use a more traditional fs.open / seek / read API, but in that case I need to somehow wrap them in a stream for underlying layers of my…
vdudouyt
  • 843
  • 7
  • 14
7
votes
2 answers

How to implement custom std::streambuf's seekoff()?

I have the following implementation based on e.g. this question and answer struct membuf : std::streambuf { membuf(char* begin, char* end) { this->setg(begin, begin, end); } protected: virtual pos_type seekoff(off_type off, …
Patryk
  • 22,602
  • 44
  • 128
  • 244
7
votes
3 answers

Can I seek a position beyond 2GB in C using the standard library?

I am making a program that reads disk images in C. I am trying to make something portable, so I do not want to use too many OS-specific libraries. I am aware there are many disk images that are very large files but I am unsure how to support these…
7
votes
4 answers

how do i know which filestream supports seek in Java

java.io.InputStream.skip() says "Throws: IOException - if the stream does not support seek, or if some other I/O error occurs." how do i know which filestream supports seek? when google i find Seekable, but i can see that simple FileInputStream,…
Rakesh Malik
  • 607
  • 1
  • 6
  • 27
7
votes
2 answers

How to get the current open file line in python?

Suppose you open a file, and do an seek() somewhere in the file, how do you know the current file line ? (I personally solved with an ad-hoc file class that maps the seek position to the line after scanning the file, but I wanted to see other hints…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
6
votes
2 answers

How to get the underlying file handle of a Stream?

I have an application that works with physical memory snapshots (for example, VMware VMEM files). Among other things, it can read processes/modules out of the snapshot by virtual rather than physical address. This involves reconstructing the module…
Wayside
  • 101
  • 2
  • 7
6
votes
2 answers

FFMPEG Seeking brings audio artifacts

I'm implementing a audio decoder using ffmpeg. While reading audio and even seeking already works, I can't figure out a way to clear the buffers after seeking so I have no artifacts when the app starts reading audio right after…
1 2
3
35 36