This post relates directly to my Raspberry Pi live stream computer build described on this page.
I had a question come in from a reader regarding the ability of the Raspberry Pi live streaming computer to handle anamorphic video. The question was whether the Raspberry Pi could compress the vertical scale of the anamorphic video. Here’s the Wikipedia page with more information on anamorphic video.
The actual question was
“Do you know if FFMPEG has the ability to stretch or scale a video image? We are shooting 1x33 anamorphic and while we can scale and adjust within OBS OK (finally) I can’t see if it’s possible in FFMPEG.”
And so I spent some time researching this question and trying out some things on my Raspberry Pi build.
And here’s what I found:
Yes, it is possible to use FFMPEG to scale or resize video to an arbitrary size. BUT… not when using the copy video codec. Here’s some information on using the -vf switch in FFMPEG to scale video. When using the copy video codec FFMPEG cannot apply any filters. Filters in FFMPEG only work on uncompressed video and the copy codec simply is taking the compressed video stream (or file) and passing it along to the output format.
There is a raspivid command for changing the output size of the video stream (or file).
raspivid -o - -t 0 -md 1 -awb sun -b 5500000 -w 640 -h 480
The above command is taking a 1080p input (specified by the -md 1 switch and outputting a video with a size of 640x480 pixels.
BUT… it’s not actually scaling the video. It’s cropping it. Here’s a screen grab of the full 1080p resolution video:
Notice that the image in the 2nd screen grab is a cropped version of the top image. It’s not the same image scaled down.
Next, I tried to change the video codec in my streaming command to use h264, which would force FFMPEG to decompress the video, then apply a filter, and then recompress the video. Which, technically worked, but the Pi could only squeeze out 2 frames per second. The Raspberry Pi just isn’t powerful enough to decompress and compress video and stream it all at the same time.
So it seems that the answer is that the Raspberry Pi can capture the HDMI output from the camera at 1080p using the Lintest PiCapture HD card, and it can stream it using FFMPEG but it definitely cannot alter the video to resize or scale it.