[FFmpeg-user] “edgedetect” with 4K resolution
barsnick at gmx.net
Wed Aug 2 00:39:15 EEST 2017
On Tue, Aug 01, 2017 at 14:02:34 +0000, Koeck, Richard wrote:
> I have come across a problem which I am wondering if you can help me.
> I would like to run a video with 4K resolution — e.g. in RAW (.dng)
> or ProRES (.mov) format — through “edgededect”. I am interested of
> maintaining as much resolution as possible; however, which is where I
> ran into problems with the mpg compression.
> Is it possible to use a different container that “mpg” as output
> file? Or does anybody have another idea on how to process an
> “edgedetect” with 4K resolution with no or little compression.
> ffmpeg -i Body.mpg –vf “edgedetect=low=0.1:high=0.4” Body_Canny_Edge.mpg
I'm having a hard time understanding the problem. All you say is "I ran
into problems with the mpg compression". Is the quality too bad?
I can only guess: The output quality sucks, due to the fact that the
extension ".mpg" lets ffmpeg select an MPEG Program Stream (MPEG-TS)
format with the mpeg1video codec, with a bandwidth of 200 kbits/s. You
won't get any quality out of that.
Both that container and that codec are bad choices nowadays. What
container and codec are acceptable for you? How about H.264 in MP4?
Whatever you do: You need to set one of the quality options
higher/better. With H.264, I would let ffmpeg choose the default first
(which is VBR with CRF 23), which is often fine, and go from there. For
mpeg1video and mpeg2video, I believe the option is "-qscale", and lower
is better. Instead, you could also set a bitrate and see if that helps,
e.g. with "-b:v 20M" (depending on codec).
I recommend H.264/MP4:
$ ffmpeg -i Body.mpg –vf "edgedetect=low=0.1:high=0.4" Body_Canny_Edge.mp4
(If that doesn't choose the codec H.264 for you, you need to set "-c:v
libx264" as output option.)
To increase the quality for libx264, add e.g. "-crf 22". 23 is the
default, lower is better.
BTW, your input is most likely named "mpg" without being an MPEG-PS. We
would know, had you shown us the command's complete, uncut console
More information about the ffmpeg-user