@@ -527,7 +527,7 @@ torch::Tensor validateFrames(const torch::Tensor& frames) {
527527 frames.sizes ()[1 ] == 3 ,
528528 " frame must have 3 channels (R, G, B), got " ,
529529 frames.sizes ()[1 ]);
530- // TODO-VideoEncoder: Investigate if non-contiguous frames can be returned
530+ // TODO-VideoEncoder: Investigate if non-contiguous frames can be accepted
531531 return frames.contiguous ();
532532}
533533
@@ -593,9 +593,6 @@ void VideoEncoder::initializeEncoder(
593593 *desiredBitRate >= 0 , " bit_rate=" , *desiredBitRate, " must be >= 0." );
594594 }
595595 avCodecContext_->bit_rate = desiredBitRate.value_or (0 );
596- // TODO-VideoEncoder: Verify that frame_rate and time_base are correct
597- avCodecContext_->time_base = {1 , inFrameRate_};
598- avCodecContext_->framerate = {inFrameRate_, 1 };
599596
600597 // Store dimension order and input pixel format
601598 // TODO-VideoEncoder: Remove assumption that tensor in NCHW format
@@ -618,7 +615,9 @@ void VideoEncoder::initializeEncoder(
618615 avCodecContext_->width = outWidth_;
619616 avCodecContext_->height = outHeight_;
620617 avCodecContext_->pix_fmt = outPixelFormat_;
618+ // TODO-VideoEncoder: Verify that frame_rate and time_base are correct
621619 avCodecContext_->time_base = {1 , inFrameRate_};
620+ avCodecContext_->framerate = {inFrameRate_, 1 };
622621
623622 // TODO-VideoEncoder: Allow GOP size and max B-frames to be set
624623 if (videoStreamOptions.gopSize .has_value ()) {
@@ -726,6 +725,7 @@ UniqueAVFrame VideoEncoder::convertTensorToAVFrame(
726725 // TODO-VideoEncoder: Reorder tensor if in NHWC format
727726 int channelSize = inHeight_ * inWidth_;
728727 // Reorder RGB -> GBR for AV_PIX_FMT_GBRP format
728+ // TODO-VideoEncoder: Determine if FFmpeg supports RGB input format directly
729729 inputFrame->data [0 ] = tensorData + channelSize;
730730 inputFrame->data [1 ] = tensorData + (2 * channelSize);
731731 inputFrame->data [2 ] = tensorData;
0 commit comments