Skip to content

Commit dc86a8c

Browse files
committed
add comment explaining default behavior
1 parent 7ef8a8f commit dc86a8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,9 @@ void VideoEncoder::initializeEncoder(
674674
validatePixelFormat(*avCodec, videoStreamOptions.pixelFormat.value());
675675
} else {
676676
const AVPixelFormat* formats = getSupportedPixelFormats(*avCodec);
677-
// Use first listed pixel format as default.
677+
// Use first listed pixel format as default (often yuv420p).
678+
// This is similar to FFmpeg's logic:
679+
// https://www.ffmpeg.org/doxygen/4.0/decode_8c_source.html#l01087
678680
// If pixel formats are undefined for some reason, try yuv420p
679681
outPixelFormat_ = (formats && formats[0] != AV_PIX_FMT_NONE)
680682
? formats[0]

0 commit comments

Comments
 (0)