[FFmpeg-user] encode to RAW video
Paul B Mahol
onemda at gmail.com
Wed Oct 26 19:31:12 EEST 2022
On 10/25/22, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 25.10.2022 um 09:29 schrieb Naveen.B:
>>> What do you want to do with the RAW video? You know that you can't play
>>> it with most players?
>>> Yes, I know it cannot be played with most of th players, I need to see
>>> size of the RAW video and make some compression on it for our further
>> Could you please help me on the missing parameters to generate the
> I did some tests and came to the conclusion that it's impossible to
> import a group of numbered raw images.
> It's possible to import a single raw image.
> It's possible to import a group of numbered images (JPG, PNG, TIF...)
> But it's not possible to import a numbered group of raw images.
> (To the experts: Please correct me if I'm wrong).
> Anyway it's a bad idea to save the images in raw format. You should use
> PNG images, which have a lossless compression, and 16-bit depth is possible.
> I recommend that you convert your images to PNG, and then things become
> much easier.
> Here is a (Windows) batch file with a few examples:
> rem Make 30 PNG images (48-bit per pixel):
> ffmpeg -f lavfi -i testsrc2=s=320x200,format=rgb48 -frames 30 -f image2
> -y image-%%03d.png
> rem Convert these 30 images to a raw video (this conversion is lossless):
> ffmpeg -i image-%%03d.png -s 320x200 -pixel_format rgb48 -f rawvideo
> -c:v rawvideo -y video.raw
> rem The size of the raw video is exactly 320 * 200 * 2 * 3 * 30 =
> 11520000 Bytes
> rem Convert the first frame from the raw video to a PNG image (48-bit
> per pixel):
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -i video.raw
> -frames 1 -y image.png
> rem Convert the raw video to a (almost lossless) MP4 video:
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -framerate 30
> -i video.raw -crf 0 -y video.mp4
> I have a question to the experts. The above example works fine with
> pixel format rgb48, but with pixel formats gray16 or gray10le the MP4
> output looks wrong. I don't yet understand why.
Not all muxers support all pixel formats as raw.
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user