2

I am trying to extract the frames from video , I have to pass the video (mp4) to deep learning model . I have successfully runs it on the gif but working on videos .

Code for gif:

image_path = 'video.gif'
image = tf.io.read_file(image_path)
image = tf.image.decode_gif(image)
print(image.shape)

Output:

TensorShape([30, 640, 352, 3]) #(num_frames, height, width, channels)

I have to pass the video like mp4 to model and some pre defined function should returns the same thing as above code is returning . Any pre defined function is available which should returns the output with (num_frames, height, width, channels) , if I pass any video ?

Hamza
  • 530
  • 5
  • 27
  • Please check https://stackoverflow.com/questions/29718238/how-to-read-mp4-video-to-be-processed-by-scikit-image and https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html however these return buffers and are not in a tensorflow suite – Proko Aug 27 '21 at 08:53
  • Please check below links. https://stackoverflow.com/questions/60543859/tfds-features-video-usage-for-video-decoding-in-tensorflow-2 https://www.tensorflow.org/datasets/api_docs/python/tfds/features/Video –  Sep 07 '21 at 17:43

0 Answers0