Raw Video Export

I am trying to save some camcorder footage as rawvideo.

The original footage is YUV 4:2:0 h.264. When I change the following code in “other” from




the video appears as scrambled eggs, i.e. not a usable image. The 4:2:2 export looks fine.

My thinking is to avoid as much resampling as possible and to have the encoder pass the 4:2:0 video without modification (and without using a “lossless” codec).


yuv420p is not a valid render target in MLT if any effects (filters, transitions, track compositing) are involved. As long as you do not use Filters or Timeline, you can do this. But depending on how you export you probably need to specify additional info to ffmpeg. For example, to save as AVI this works:

  • Format = avi
  • Video codec = rawvideo
  • Other:

I tried those steps and no improvement. No filters, no timeline.

There shouldn’t be a need to change the internal processing mode of Shotcut with the mlt_image_format line. If implemented correctly end-to-end, doing nearest neighbor scaling from 4:2:0 sources to 4:2:2 internal processing then to 4:2:0 for export should be lossless. The options that need to be set are:

  • Export > Advanced > Video > Interpolation > Nearest neighbor
  • Export > Advanced > Other > pix_fmt=yuv420p

This assumes that the in and out resolutions are the same, meaning only the chroma plane is getting scaled. When the chroma plane is doubled then halved, we end up right back where we were. This is why bicubic or other scaling methods would break the lossless nature of chroma scaling and cannot be used for this purpose. They have spline extrapolation that will cause bleed across pixel borders instead of the mathematically-precise double-and-half approach to scaling that nearest neighbor does.

I tried my raw export again with “nearest neighbor” and the following in “other”. It still comes out as 4:2:2. This was using the current beta version.


Remove all the mlt_* lines and try it again with only this line:


pix_fmt alters the export mode. mlt_image_format alters the Shotcut internal processing format, which we’ve established is not going to work.

No joy. It’s still 4:2:2.

And the audio MUST be pcm_s16le or the export will fail.

The 2nd post works for uncompressed 8bit 4:2:0 video, not true “raw video” . (The distinction is “raw video” is containerless, headerless)

Codec ID : I420
Codec ID/Info : 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.

ffprobe/ffmpeg identify it as I420 yuv420p

Confirmed with PSNR
[Parsed_psnr_4 @ 000000693de3eec0] PSNR y:inf u:inf v:inf average:inf min:inf max:inf

It imports back into shotcut correctly and other programs, media players.

It might be that whatever program you are using cannot read fourcc I420. There are slightly different 8bit 4:2:0 configurations in terms of arrangements of how the data is stored. For example, “YV12”, “NV12”, “IYUV” are all 8bit 4:2:0 but just arranged slightly differently .

The designation in Shotcut is “raw video”.

Are you talking about the playback that looks like scrambled eggs?

I’m getting scrambled eggs on MPC, VLC, WMP. “Movies & TV” gives an error message. Four different players that can’t handle this clip in 4:2:0.

MediaInfo says “Y42B” for codec ID and “YUV 4:2:2 Planar” for codec ID/Info.

No scrambled eggs. Works ok here as expected, all players MPC,VLC,WMP. AVC 4:2:0 source, uncompressed 4:2:0 output in I420 configuration. No filters, just drop on timeline and export .

shotcut beta version dated 191208

What are your export settings?

Same as the 2nd post

I saved a preset
format: avi
codec tab: rawvideo


One difference was no audio, but that shouldn’t affect the video

That was from the timeline .

I did a second test with cuts only editing and it worked ok too. Verified lossless, no other things like upsampling going on

My export settings are the same as PDR except without the mlt_image_format specifier and with nearest neighbor interpolation. This lets me throw on titles, filters, etc and export a finished project with the least amount of loss possible within Shotcut (for full projects, not single-file transcoding that might be better served with CLI FFmpeg). The resulting file from Shotcut is showing 4:2:0 like PDR’s.

chris319, what happens if you bring your exported video back into Shotcut and look at the Properties tab there? Does it also say yuv422p like the media players?

Well it mysteriously started working with the same code as in post #2 which I had tried previously with no success.


It has audio, too.