0
\$\begingroup\$

I have succeeded in displaying an image on a VGA monitor using FPGA, by generating a ROM loaded with a coe file. But knowing that a video is a succession of images, how can I do that? Any ideas please?

Note that the video that I want to display is not retrieved from camera or real-time, it's just a short mp4 video file.

I have FYI looked in multiple books like that of Volnei A.Pedroni, Cem Unsalan and Bora Tar, and Pong P. Chu about displaying a video but all they talk about is the generation of a single image, which is what I have done.

New contributor
tbs1996 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Do you actually need it to display MP4 files? If so, what specific encoding? MP4 is a relatively complex container format. For someone relatively inexperienced with FPGAs, I'd suggest using something quite raw, maybe something custom for simplicity/ease of understanding - just a sequence of raw images in memory, un- or only simply RLE compressed for simplicity. Odds are however that you'll have to use external memory for storing the video, FPGA's internal memory tends to be quite limited. You'll also probably have to write some software/scripts to convert the original video into this format. \$\endgroup\$ – Richard the Spacecat Apr 8 at 10:51
  • 1
    \$\begingroup\$ As to how you'd actually make it display video instead of a single image, that should be fairly simple - just have a timer that overflows (or compare-resets) as often as your framerate demands, and whenever it does, just load a new frame into your framebuffer (assuming you have one). If you don't, and there's no space for it, do enjoy the interesting puzzle/challenge. \$\endgroup\$ – Richard the Spacecat Apr 8 at 10:59
  • 1
    \$\begingroup\$ Congratulations on getting your previous questions working; you've now given yourself a much bigger problem! You may be able to find an MP4 decoder on opencores.org, but it would probably be easier to decode to a set of still images on PC and store them on the device. \$\endgroup\$ – pjc50 Apr 8 at 11:00
1
\$\begingroup\$

There are two approaches. One is a ROM or external RAM big enough to hold multiple images, each starting at a different base address. Simply change the base address each frame period...

If your FPGA allows a large enough ROM, you can decode the MP4 file into a series of RGB images on the host computer and generate a very big .coe file from that.

The other approach is to compute each frame at the time you need it; storing it into a pair of RAMs where your ROM is now. Compute into one RAM while you are displaying the other; at the end of the frame, swap the RAMs (this is called double buffering; most FPGAs supply dual port RAM blocks to make this easy).

For simple graphics, or text via a font LUT this is relatively easy, but an MP4 decoder is a very complex task compared to a trivial VGA controller.

\$\endgroup\$
1
  • \$\begingroup\$ I think that the conversion of the video to a very large .coe file is a good idea. And knowing that my FPGA board has an SD memory card reader, I can use a memory card as an external ROM. Thank you all for your help. \$\endgroup\$ – tbs1996 Apr 8 at 14:33
0
\$\begingroup\$

You should unencode, that is decompress, your MP4 stream.


Step 1

  • Decompress, your MP4 stream which is made up of GOP's, in a sequence of 13 JPG pictures.

  • A GOP is a group of 13 pictures.

  • This is the toughest part.

  • You can do it in software using some open source library.

  • You can do it in hardware if you find an open source VHDL or Verilog library.

Step 2

  • Transform each image from JPG to RGB

Step 3

  • Send each image to your VGA monitor.
\$\endgroup\$

Your Answer

tbs1996 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.