35 fprintf(ret ? stderr : stdout,
36 "Usage: seek_print file [command ...]\n"
39 " seek:stream:min_ts:ts:max_ts:flags\n"
44 int main(
int argc,
char **argv)
46 int opt, ret, stream,
flags;
49 int64_t min_ts, max_ts, ts;
52 while ((opt =
getopt(argc, argv,
"h")) != -1) {
70 fprintf(stderr,
"%s: %s\n", filename,
av_err2str(ret));
74 fprintf(stderr,
"%s: could not find codec parameters: %s\n", filename,
79 for (; argc; argc--, argv++) {
80 if (!strcmp(*argv,
"read")) {
83 printf(
"read: %d (%s)\n", ret,
av_err2str(ret));
86 printf(
"read: %d size=%d stream=%d dts=%s (%s) pts=%s (%s)\n",
92 }
else if (sscanf(*argv,
"seek:%i:%"SCNi64
":%"SCNi64
":%"SCNi64
":%i",
93 &stream, &min_ts, &ts, &max_ts, &flags) == 5) {
95 printf(
"seek: %d (%s)\n", ret,
av_err2str(ret));
97 fprintf(stderr,
"'%s': unknown command\n", *argv);
timestamp utils, mostly useful for debugging/logging purposes
AVStream ** streams
A list of all streams in the file.
static void usage(int ret)
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static int getopt(int argc, char *argv[], char *opts)
Rational number (pair of numerator and denominator).
int main(int argc, char **argv)
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...