Skip to content

Play Raw Video Streams

WangBin edited this page Mar 3, 2015 · 5 revisions

libavformat supports raw video streams that only contains video frame data without any other information.

To get a raw yuv stream for testing, you can run

ffmpeg -i test.mp4 -c:v rawvideo -pix_fmt yuv420p test.yuv

To play the yuv stream with ffplay

ffplay -f rawvideo -pix_fmt yuv420p -s 1280x720 -i test.yuv

To play the yuv stream in QtAV player, you have to set some options for libavformat like ffplay does.

Open Setup dialog->Open AVFormat tab->Fill Extra with video_size=1280x720 pixel_format=yuv420p framerate=25->Play test.yuv

You can also setup in C++ code

QVariantHash fmt_opt;
fmt_opt["video_size"] = "1280x720";
fmt_opt["pixel_format"] = "yuv420p";
fmt_opt["framerate"] = 25;
player->setOptionsForFormat(fmt_opt);
player->setFile("test.yuv");
player->play();

Unlike ffplay, QtAV currently detect the format "rawvideo" by file extension, for example, "yuv", "rgb"

Clone this wiki locally