File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -980,7 +980,13 @@ VideoDecoder::DecodedOutput VideoDecoder::getFramePlayedAtTimestampNoDemux(
980980 return seconds >= frameStartTime && seconds < frameEndTime;
981981 });
982982 // Convert the frame to tensor.
983- auto output = convertAVFrameToDecodedOutput (rawOutput);
983+ auto streamIndex = rawOutput.streamIndex ;
984+ auto metadata = containerMetadata_.streams [streamIndex];
985+ auto options = streams_[streamIndex].options ;
986+ auto height = options.height .value_or (*metadata.height );
987+ auto width = options.width .value_or (*metadata.width );
988+ auto preAllocatedOutputTensor = makeEmptyHWCTensor (height, width);
989+ auto output = convertAVFrameToDecodedOutput (rawOutput, preAllocatedOutputTensor);
984990 output.frame = MaybePermuteHWC2CHW (output.streamIndex , output.frame );
985991 return output;
986992}
You can’t perform that action at this time.
0 commit comments