1

Topic: Prores HQ HD in - Prores HQ SD out

Hi, I am downscaling an HD movie from 1920x1080 to 720x576 and want to make sure the color conversion is done correctly, which with my current settings I am sure it is not. I am coming from an HD Prores HQ, going to an SD Prores HQ.With my current command (below) it is introducing a very faint green pattern / interference, I can see this when zooming into the video. If remove the colormatrix=bt709:bt601 altogether then the very faint green pattern / interference goes, but the output file is now brighter than the original, so isn't doing the 709 to 601 conversion. So my question is do I need any color conversion (is ffmpeg already doing this for me) and if I do, what would be the correct way to apply this?
I am using Hybrid to see the what the command line is from there, and is more or less matching what I am doing, but is still producing these issues. I am using ffmpeg 2.5.3.

ffmpeg -r 25 -i "/Volumes/Kevs_GRAID/Downconvert_Tests/TestInput.mov" -loglevel debug -af atempo=1.04166666667 -map 0:0 -vf scale=720:576,colormatrix=bt709:bt601 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 -map 0:7 -vcodec prores -profile:v 3 -c:a pcm_s16le -y "/Volumes/Kevs_GRAID/Downconvert_Tests/TestOutput.mov"

Also, by default, I see that Hybird first creates a Prores HQ with ffmpeg, then uses that to create another Prores file with ffmbc. I wondered why this is?

Kind regards.

2

Re: Prores HQ HD in - Prores HQ SD out

Also, by default, I see that Hybird first creates a Prores HQ with ffmpeg, then uses that to create another Prores file with ffmbc. I wondered why this is?

Problem with ffmbc is that it is rarely updated. Which is Hybrid didn't use it at all until recently.
I added ffmbc for muxing since Quicktime otherwise seems to have problems (see: http://forum.selur.de/topic622-bug-when … 7271.html) with the created mov files and the ffmpeg team didn't react to the associated bug report.
So ffmbc is not used for the encoding since ffmpeg is normally newer and I still hope that ffmpeg fixes the problem and I can drop ffmbc.  smile


So my question is do I need any color conversion (is ffmpeg already doing this for me) and if I do, what would be the correct way to apply this?

That depends. smile
a. not all HD content really is bt709, so using colormatrix=bt709:bt601 might not be correct.
b. normally I would recommend to do the colormatrix change before the resizing
c. downsizing normally changes the color, since most resizers are not gamma aware (see: http://entropymine.com/imageworsener/gamma/ and http://forum.doom9.org/showthread.php?t=160038)
sadly my experience with gamma aware resizers is really limited (+ I don't know of a way to do gamma aware resizing with ffmpeg -> if someone can tell me a way to use ffmpeg to do gamma aware resizing I would be happy to add support for it in Hybrid)

Cu Selur

3 (edited by speedyrazor 2015-01-24 17:45:57)

Re: Prores HQ HD in - Prores HQ SD out

Hi Cu Selur, thanks for your quick response. A real shame about ffmpeg not having gamma aware resizers, as I have just been working on a rather large standards converter, client, server, application (in python), for converting, downscaling, 23.98 HD to 25 SD PAL and 29.97 SD NTSC via speedup / 3:2 and visa versa, while maintaining audio pitch. The results are very impressive, BUT... I am stuck at this color / gamma / green pattern interference issue that stopped me in my tracks.
I was doing the colormatrix before the resize originally, which is where I spotted the original issue. If I remove the colormatrix altogether, then this issue goes away, but them I have a gamma shift sad
Any suggestions as to which way i could turn next, as I've done so much work on this application, I would hate to ditch it now?

Kind regards.

4

Re: Prores HQ HD in - Prores HQ SD out

Cu = See you
Selur = my nick name smile

May be something similar to http://www.personal-view.com/talks/disc … ress-topic could be done.
(you might want to ask over at forum.doom9.org, http://www.personal-view.com or another forum, my experience with downscaling HD to SD is rather limited, but my guess is that there should be a ware to do it better)

5

Re: Prores HQ HD in - Prores HQ SD out

Another thing I just thought about.
Is you content all tv scale (16-235) if not you also get color changes,...
So setting the in_range and out_range when using colormatrix might also help.

Cu Selur

6 (edited by speedyrazor 2015-01-25 12:05:29)

Re: Prores HQ HD in - Prores HQ SD out

Hi Selur, thanks for the info, interesting reading.
Another thing is with ffmbc, I was unable to get this working:

ffmbc -r 25 -i inputFile.mov outputFile.mov

As it didn't like the -r 25 stated for the input, anyway round this, as I would just like to do a speed change?

Excellent app by the way, what language did you write it in?

7

Re: Prores HQ HD in - Prores HQ SD out

ffmbc -r 25 -i inputFile.mov outputFile.mov

Looks just wrong. smile
a. you normally only have to enforce a specific input frame rate if the input isn't detected properly otherwise
b. not specifying vcodec and acodec handling will tell ffmpeg/ffmbc to use the default values, which is probably not what you want.

-> Have you tried specifying vcodec and acodec handling and moving the frame rate specification to the end?

ffmbc -i inputFile.mov -vcodec copy -acodec copy -r 25 outputFile.mov

Cu Selur

Ps.: moved the topic to 'AV Talk' since it's not really Hybrid specific. smile

8

Re: Prores HQ HD in - Prores HQ SD out

The issue with that is that it drops / adds frames to get to the desired frame rate, where specifying the input frame rate does not, motion is very smooth, and this works with ffmpeg (I missed out the codec stuff, just for example).

Great app by the way, what language did you write it in?

Cheers.

9

Re: Prores HQ HD in - Prores HQ SD out

Great app by the way, what language did you write it in?

Hybrid is written in C++ using the Qt framework for easier cross-plattform support.
(+ When I started, I wanted to freshen up my C++ skills since I mainly wrote Java code before hat.)

The issue with that is that it drops / adds frames to get to the desired frame rate, where specifying the input frame rate does not, motion is very smooth, and this works with ffmpeg (I missed out the codec stuff, just for example).

If you specify the frame rate before the input, you overwrite the detected input frame rate, so if you really want to speed up your content, this is the way to go. If you want to convert the input fps to the output fps you need to specify the frame rate behind the input. With audio&video set to copy setting the frame rate after the input, should only rewrite the container frame rate flag. (I think the main problem, why your command line didn't work is because of the not specified codec handling. smile)

Cu Selur

10

Re: Prores HQ HD in - Prores HQ SD out

Sorry, should have put the full command and output down, it is saying 'Option framerate not found.' Here is the output:

ffmbc -r 25 -i /Users/kev/Documents/MOVS/Source22.mov -vcodec prores_ks -profile:v 3 -vtag apcn -f mov -c:a pcm_s16le /Users/kev/Documents/MOVS/source22_Done.mov
FFmbc version 0.7.2
Copyright (c) 2008-2014 Baptiste Coudurier and the FFmpeg developers
Option framerate not found.

11

Re: Prores HQ HD in - Prores HQ SD out

Just checked the documentation, '-r X' before the input is only supported for raw video streams.
So to change the speed of the playback during reencoding you would need to use setpts, see: https://www.ffmpeg.org/ffmpeg-all.html# … mples-105.

Btw. I hope you are aware that ProRes isn't lossless, which is why Apple (http://support.apple.com/en-au/HT202410) only is speaking of 'visually lossless through many generations of decoding and reencoding' and not of lossless in general, so doing such conversions aren't lossless! To keep this lossless you would need to:
1. extract the video stream
2. remux the video stream and change the frame rate during muxing

Cu Selur