Skip to content

Commit 598495a

Browse files
authored
Restore comment about getting stream info (#449)
1 parent cd7cef6 commit 598495a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ VideoDecoder::VideoDecoder(const void* buffer, size_t length) {
237237
void VideoDecoder::initializeDecoder() {
238238
TORCH_CHECK(!initialized_, "Attempted double initialization.");
239239

240+
// In principle, the AVFormatContext should be filled in by the call to
241+
// avformat_open_input() which reads the header. However, some formats do not
242+
// store enough info in the header, so we call avformat_find_stream_info()
243+
// which decodes a few frames to get missing info. For more, see:
244+
// https://ffmpeg.org/doxygen/7.0/group__lavf__decoding.html
240245
int ffmpegStatus = avformat_find_stream_info(formatContext_.get(), nullptr);
241246
if (ffmpegStatus < 0) {
242247
throw std::runtime_error(

0 commit comments

Comments
 (0)