<p>DNxHD and JPEG are not the only game in town as far as intermediate codecs are concerned (intermediate codecs being high-quality, visually lossless codecs designed for moving media between steps in a post-production chain). Probably the most-used intermediate codec is Apple's prores 422, which can be encoded cross platform using ffmpeg thus:</p>

<pre><code>ffmpeg -i uncompressed.mov -c:v prores -profile:v 3 -c:a pcm_s16le output.mov
</code></pre>

<p>One of the biggest advantages of prores is the support for 10-bit encoding, giving you much better colour fidelity. You can also use the <a href="https://video.stackexchange.com/a/19312/1950">prores 4444 variation</a> to avoid chroma subsampling (reduction of the colour resolution) and alpha channel support.</p>

<p>Failing that you can use motion-JPEG, or even 2 flavours of lossless JPEG (I have no idea what the difference is). Oh and there's JPEG2000 if you really want, though it's not recommended. Substitute your codec of choice here:</p>

<pre><code>ffmpeg -i uncompressed.mov -c:v CODEC -c:a pcm_s16le output.mov
</code></pre>

<p>where <code>CODEC</code> is one of:</p>

<ul>
<li><code>jpegls</code> - lossless JPEG (?)</li>
<li><code>ljpeg</code> - another lossless JPEG (?)</li>
<li><code>mjpeg</code> - <a href="https://ffmpeg.org/ffmpeg-codecs.html#mjpeg" rel="nofollow noreferrer">motion JPEG</a></li>
<li><code>jpeg2000</code> - <a href="https://ffmpeg.org/ffmpeg-codecs.html#jpeg2000" rel="nofollow noreferrer">JPEG 2000</a></li>
</ul>

<p>Since you're on linux I won't suggest Cineform, it's a good intermediate codec on win/mac but I don't think there's a CFHD codec for linux yet, and ffmpeg can only decode it (it's been <a href="https://gopro.com/news/gopro-open-sources-the-cineform-codec" rel="nofollow noreferrer">open-sourced</a> so that will probably change). There are a couple of more obscure ones like <a href="https://www.edius.net/hqx.html" rel="nofollow noreferrer">Grass Valley</a>, <a href="https://www.videohelp.com/software/HuffYUV" rel="nofollow noreferrer">huffyUV</a>, dirac and so on, but if you can't use DNxHD it's unlikely these will be any use to you. Just as an aside, DNxHD is <a href="http://avid.force.com/pkb/articles/en_US/Download/en423319" rel="nofollow noreferrer">freely available from Avid</a>, is it possible to install the codec on the target machine?</p>

CC BY-SA 3.0
2018-01-17T03:32:51.160Z
J2K isn't the best mezzanine format. It has some peculiarities that make it better suited to being a transport codec. In other words, it takes a lot of tuning for the application and in a mezzanine setting, you don't take advantage of the unique features of it that make the tuning worthwhile.
Michael Liebman
CC BY-SA 3.0
2018-01-17T05:01:34.373Z
Good point, I just did `ffmpeg -codecs|grep jpeg` so I thought I'd add it for completeness. I've personally had nothing but trouble with jpeg2000.
stib
CC BY-SA 3.0
2018-01-17T09:24:02.520Z
Thanks, prores 422 seems to work well (giving a 1gb file). I tried using both uncompressed and DNxHD as the input, the latter running a bit quicker (14s vs. 18s). Their output is visually identical, as far as I can tell.
Darren Cook
CC BY-SA 3.0
2018-01-17T01:22:29.757Z
2018-01-17T12:33:48.737Z
2018-01-17T12:33:48.737Z
stib
<p>I've a 30-second clip, which is HD 1080p, 30fps, "Photo JPEG" compression, 480MB.</p>

<p>I've brought it into Fusion 9, made a small change, and rendered: but the Saver options (under Quicktime) are either uncompressed (which gives me a 5GB file!!), or DNxHD (e.g. "DNxHD HQ 1080p, 8 bit" gives me an 820MB file). (I think the lack of choices might be a limitation of the Linux version of Fusion 9?)</p>

<p>The next tool in the chain does not read DNxHD; I could work with the uncompressed file, but I'd like to avoid big files if I can. Can I use ffmpeg to convert it to the original "Photo JPEG" format?  (If not, is there something of similar quality and file size?)</p>

<p>("it" being either the uncompressed file or the DNxHD file)</p>

<p>I'd like to find the settings that give a nice file size reduction, but with no <em>noticeable</em> reduction in quality. I want to have my cake and eat it ;-) </p>

<ffmpeg><fusion>
Using ffmpeg to convert to Photo Jpeg with minimal loss of quality
Darren Cook
# Using ffmpeg to convert to Photo Jpeg with minimal loss of quality

(Asked by: username_0 on 2018-01-16)

I've a 30-second clip, which is HD 1080p, 30fps, "Photo JPEG" compression, 480MB.

I've brought it into Fusion 9, made a small change, and rendered: but the Saver options (under Quicktime) are either uncompressed (which gives me a 5GB file!!), or DNxHD (e.g. "DNxHD HQ 1080p, 8 bit" gives me an 820MB file). (I think the lack of choices might be a limitation of the Linux version of Fusion 9?)

The next tool in the chain does not read DNxHD; I could work with the uncompressed file, but I'd like to avoid big files if I can. Can I use ffmpeg to convert it to the original "Photo JPEG" format? (If not, is there something of similar quality and file size?)

("it" being either the uncompressed file or the DNxHD file)

I'd like to find the settings that give a nice file size reduction, but with no *noticeable* reduction in quality. I want to have my cake and eat it ;-)

**Tags:** ffmpeg, fusion


---

## 1 answers

### Answer by username_1 on 2018-01-17. Score: 3 | Accepted answer

DNxHD and JPEG are not the only game in town as far as intermediate codecs are concerned (intermediate codecs being high-quality, visually lossless codecs designed for moving media between steps in a post-production chain). Probably the most-used intermediate codec is Apple's prores 422, which can be encoded cross platform using ffmpeg thus:
ffmpeg -i uncompressed.mov -c:v prores -profile:v 3 -c:a pcm_s16le output.mov

One of the biggest advantages of prores is the support for 10-bit encoding, giving you much better colour fidelity. You can also use the prores 4444 variation to avoid chroma subsampling (reduction of the colour resolution) and alpha channel support.
Failing that you can use motion-JPEG, or even 2 flavours of lossless JPEG (I have no idea what the difference is). Oh and there's JPEG2000 if you really want, though it's not recommended. Substitute your codec of choice here:
ffmpeg -i uncompressed.mov -c:v CODEC -c:a pcm_s16le output.mov

where CODEC is one of:

jpegls - lossless JPEG (?)
ljpeg - another lossless JPEG (?)
mjpeg - motion JPEG
jpeg2000 - JPEG 2000

Since you're on linux I won't suggest Cineform, it's a good intermediate codec on win/mac but I don't think there's a CFHD codec for linux yet, and ffmpeg can only decode it (it's been open-sourced so that will probably change). There are a couple of more obscure ones like Grass Valley, huffyUV, dirac and so on, but if you can't use DNxHD it's unlikely these will be any use to you. Just as an aside, DNxHD is freely available from Avid, is it possible to install the codec on the target machine?

> **Comments:**
> **username_2**: J2K isn't the best mezzanine format. It has some peculiarities that make it better suited to being a transport codec. In other words, it takes a lot of tuning for the application and in a mezzanine setting, you don't take advantage of the unique features of it that make the tuning worthwhile.  
> **username_1**: Good point, I just did `ffmpeg -codecs|grep jpeg` so I thought I'd add it for completeness. I've personally had nothing but trouble with jpeg2000.  
> **username_0**: Thanks, prores 422 seems to work well (giving a 1gb file). I tried using both uncompressed and DNxHD as the input, the latter running a bit quicker (14s vs. 18s). Their output is visually identical, as far as I can tell.  

---

