I am trying to decode a video in tensorflow 2 using tfds.features.Video , so that the output is a "tf.Tensor of type tf.uint8 and shape [num_frames, height, width, channels]" using following code :
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_datasets as tfds
df_trains= pd.DataFrame()
df_trains['video_files']= ['aa.mp4']
files_ds = tf.data.Dataset.from_tensor_slices(df_trains.video_files)
video_class = tfds.features.Video(shape=(None, 1080, 1920,3), encoding_format='png', ffmpeg_extra_args=())
a= video_class.decode_example(files_ds)
However it generates following error:
"AssertionError: Feature Video can only be decoded when defined as top-level feature, through info.features.decode_example()"
I am unable to solve it, please help in this regard.