[FFmpeg-user] How to dynamically drop frames as required to keep transcoding real time?

2021-04-05 Thread Adrian Cable
Hi,
I have a question that I thought should have an ‘easy’ answer – I have spent a 
lot of time searching and I cannot find it, so thought I would ask here.

My application sounds simple. I have an input RTSP stream, which I need to 
transcode and output as an RTP stream. Command line is very simple, something 
like:

./ffmpeg -i rtsp://… -vf scale=1024:-1 -c:v libx264 -f rtp rtp://…

Now, ffmpeg is running on a CPU-constrained platform, and it may be that, in 
order for the transcoding to ‘keep up’ with the input, the output framerate 
needs to be less than the input framerate, which is totally fine. The 
problem/question is: how do I get ffmpeg to drop frames as required to keep the 
pipeline running real time?

I can’t simply ‘guess’ a sustainable output framerate and set using -r XXX or 
-vf fps=fps=XXX, because the properties of the input can change at any time, so 
any XXX won’t be constant. Besides, if the ‘guess’ is too high for the CPU 
power I have available, the encoder won’t keep up with the input frames and so 
will ‘run away’ (i.e. the time difference between each input frame and its 
corresponding output frame will get bigger and bigger), which is the problem I 
am trying to solve. On the other hand, if the ‘guess’ is too low, I will end up 
with real-time output but I will also be potentially transcoding to a lower 
output frame rate than I have the CPU power to do, which I don’t want either.

What I need is some kind of dynamic framerate filter that doesn’t take a number 
at all (or maybe takes simply a maximum), and drops frames if and only if the 
encoder can’t keep up … so the pipeline produces as high a frame rate output as 
possible, while still being real time.

I cannot figure out how to do this. Surely this wish can’t be super uncommon as 
you would imagine it would be quite important in all sorts of streaming 
applications where unlimited transcoding power is not guaranteed to be 
available. Can anyone help?

-Adrian
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Michael Koch  writes:

> If you want to cover the whole frame size, you could also use this (for
> 50% gray):
> eq=enable='bitor(between(t, 0, 2),between(t, 339, 342))':contrast=0
> or add :brightness=-0.5 if you want black.
> It might be faster than drawbox.

It is not faster. It also keeps a 'shadow' of the video. I will play a
little more with it, but the change is high that I go back to drawbox.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Using Homebrew to install FFmpeg, But having wired problems.

2021-04-05 Thread Laine Lee
On 4/4/21, 9:39 PM, "ffmpeg-user on behalf of Kosei Seki" 
 wrote:

 

(base) XXX-MacBook-Air ~ % brew install ffmpeg --HEAD

Updating Homebrew...

==> Installing ffmpeg from homebrew-ffmpeg/ffmpeg

==> Searching for similarly named formulae...

Error: No similarly named formulae found.

Error: No available formula with the name "nasm" (dependency of 
homebrew-ffmpeg/ffmpeg/ffmpeg).

==> Searching for a previously deleted formula (in the last month)...

Error: No previously deleted formula found.

==> Searching taps on GitHub...

Error: No formulae found in taps.

How can I solve this problem? Thx

 

This looks promising:

https://github.com/Homebrew/discussions/discussions

 

L. Lee

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] Timestamps are unset in a packet for stream 1. UDP Streaming

2021-04-05 Thread Mar Andrés López
Dear all,

My video which has KLV metadata on stream 1, is not timestamped properly, when 
streaming udp. ¿Is there anyway to recreate the timestamps? I am doing 
something wrong when streaming by udp.

The command employed is the following:

>>ffmpeg -re -i klv.mpeg -map 0 -codec copy -f mpegts 
>>udp://127.0.0.1:9000?pkt_size=1316

ffmpeg version N-101612-gda12d600ea Copyright (c) 2000-2021 the FFmpeg 
developers
  built with gcc 9.3-win32 (GCC) 20200320
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static 
--pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 
--target-os=mingw32 --enable-gpl --enable-version3 --disable-debug 
--enable-shared --disable-static --disable-w32threads --enable-pthreads 
--enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype 
--enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig 
--enable-opencl --enable-libvmaf --enable-vulkan --enable-libvorbis 
--enable-amf --enable-libaom --enable-avisynth --enable-libdav1d 
--enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang 
--enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame 
--enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp 
--enable-lv2 --enable-libmfx --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e 
--enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr 
--enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d 
--enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 
--enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC 
--extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
  libavutil  56. 68.100 / 56. 68.100
  libavcodec 58.133.100 / 58.133.100
  libavformat58. 74.100 / 58. 74.100
  libavdevice58. 12.100 / 58. 12.100
  libavfilter 7.109.100 /  7.109.100
  libswscale  5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc55.  8.100 / 55.  8.100
[mpegts @ 02c852e57000] start time for stream 1 is not set in 
estimate_timings_from_pts
Input #0, mpegts, from 'klv.mpeg':
  Duration: 00:01:30.80, start: 0.50, bitrate: 1347 kb/s
  Program 1
  Stream #0:0[0x3e8]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), 
yuv420p(tv, bt470bg, progressive), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr, 
90k tbn, 60 tbc
Side data:
  cpb: bitrate max/min/avg: 100/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1[0x90]: Data: klv (KLVA / 0x41564C4B)
Output #0, mpegts, to 'udp://127.0.0.1:9000?pkt_size=1316':
  Metadata:
encoder : Lavf58.74.100
  Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, 
bt470bg, progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 30 fps, 30 tbr, 90k 
tbn, 90k tbc
Side data:
  cpb: bitrate max/min/avg: 100/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1: Data: klv (KLVA / 0x41564C4B)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 02c854add100] Timestamps are unset in a packet for stream 1. This 
is deprecated and will stop working in the future. Fix your code to set the 
timestamps properly
frame=   31 fps= 30 q=-1.0 size=  66kB time=00:00:01.03 bitrate= 
524.0kbits/s speed=   1x


P Please consider the environment before printing this e-mail.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Michael Koch  writes:

> Am 05.04.2021 um 11:58 schrieb Cecil Westerhof via ffmpeg-user:
>> Michael Koch  writes:
>>
>>> Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user:
 I have to cut out a part of a video, crop it and blackout two parts.
 I do this with:
   ffmpeg -y  \
  -ss 00:19:49\
  -i  2021-03-25ToastmastersClubAvond.mp4 \
  -to 442 \
  -vf "
   crop = 1440:1080:240:0
   ,
   drawbox=enable='between(t, 0, 2)' :
  color = black  :
  w = in_w   :
  h = in_h   :
  thickness = fill
   ,
   drawbox=enable='between(t, 339, 342)' :
  color = black  :
  w = in_w   :
  h = in_h   :
  thickness = fill
  "   \
  -acodec copy\
  -vcodec libx264 \
  -crf23  \
  speechClean2.mp4

 The reason I do -to in the output is that in this way the metadata
 concerning the video length is less out of whack.

 I was wondering if this is a good way, or that it could be done
 better?
 Also, beside the timestamps the parameters for drawbox are the same.
 Is there a way that I do not have to repeat them?
>>> drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))'
>> Works like a charm.
>>
>> Strange thing is that it seems to be much faster. About 20%. To much
>> to be because of different load I think.
>> But I am not complaining. ;-)
>
> If you want to cover the whole frame size, you could also use this (for
> 50% gray):
> eq=enable='bitor(between(t, 0, 2),between(t, 339, 342))':contrast=0
> or add :brightness=-0.5 if you want black.
> It might be faster than drawbox.

I will try that out later. At the moment I am working with the
different preset values. It seems that veryfast is still the best. And
that you really should not use ultrafast.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Cecil Westerhof via ffmpeg-user  writes:

> I have to cut out a part of a video, crop it and blackout two parts.
> I do this with:
> ffmpeg -y  \
>-ss 00:19:49\
>-i  2021-03-25ToastmastersClubAvond.mp4 \
>-to 442 \
>-vf "
> crop = 1440:1080:240:0
> ,
> drawbox=enable='between(t, 0, 2)' :
>color = black  :
>w = in_w   :
>h = in_h   :
>thickness = fill
> ,
> drawbox=enable='between(t, 339, 342)' :
>color = black  :
>w = in_w   :
>h = in_h   :
>thickness = fill
>"   \
>-acodec copy\
>-vcodec libx264 \
>-crf23  \
>speechClean2.mp4

With the help of this mailing list I changed it to:
ffmpeg -y  \
   -ss 00:19:49\
   -i  2021-03-25ToastmastersClubAvond.mp4 \
   -to 442 \
   -vf "
crop = 1440:1080:240:0
,
drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))' :
   color = black  :
   w = in_w   :
   h = in_h   :
   thickness = fill
   "   \
   -acodec copy\
   -vcodec libx264 \
   -preset veryfast\
   -crf28  \
   speechClean3.mp4

The input quality is probably poor, that is why I switched to crf 28.
I do not see a difference in quality.

I use veryfast because that probably gives (counter-intuitively) the
smallest size.


> The reason I do -to in the output is that in this way the metadata
> concerning the video length is less out of whack.
>
> I was wondering if this is a good way, or that it could be done
> better?
> Also, beside the timestamps the parameters for drawbox are the same.
> Is there a way that I do not have to repeat them?
>
> I started the crf with 16, then 20 and lastly 23.
>
> The input file has:
> Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1920x1080, 2070 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
>
> With crf 16 I get:
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 5541 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
>
> With crf 20 I get:
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 3538 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
>
> And with crf 23 I get:
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 2444 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)

With crf 28 and preset veryfast I get:
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
1440x1080, 1056 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)


When I have better quality video I should maybe change crf back to 23.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Michael Koch

Am 05.04.2021 um 11:58 schrieb Cecil Westerhof via ffmpeg-user:

Michael Koch  writes:


Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user:

I have to cut out a part of a video, crop it and blackout two parts.
I do this with:
  ffmpeg -y  \
 -ss 00:19:49\
 -i  2021-03-25ToastmastersClubAvond.mp4 \
 -to 442 \
 -vf "
  crop = 1440:1080:240:0
  ,
  drawbox=enable='between(t, 0, 2)' :
 color = black  :
 w = in_w   :
 h = in_h   :
 thickness = fill
  ,
  drawbox=enable='between(t, 339, 342)' :
 color = black  :
 w = in_w   :
 h = in_h   :
 thickness = fill
 "   \
 -acodec copy\
 -vcodec libx264 \
 -crf23  \
 speechClean2.mp4

The reason I do -to in the output is that in this way the metadata
concerning the video length is less out of whack.

I was wondering if this is a good way, or that it could be done
better?
Also, beside the timestamps the parameters for drawbox are the same.
Is there a way that I do not have to repeat them?

drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))'

Works like a charm.

Strange thing is that it seems to be much faster. About 20%. To much
to be because of different load I think.
But I am not complaining. ;-)


If you want to cover the whole frame size, you could also use this (for 
50% gray):

eq=enable='bitor(between(t, 0, 2),between(t, 339, 342))':contrast=0
or add :brightness=-0.5 if you want black.
It might be faster than drawbox.

Michael

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Cecil Westerhof via ffmpeg-user  writes:

> Nicolas George  writes:
>
>> Carl Eugen Hoyos (12021-04-05):
>>> There is a fundamental misunderstanding:
>>> You decide how much quality you want to preserve, x264 decides how
>>> much bitrate is needed to reach that quality.
>>
>> You also decide how much computing power you want to spend on it, which
>> Cecil neglected to do. More computing power usually means lower bitrate
>> for same quality. The keyword is "preset".
>
> Yes, that was not smart.
>
> The funny thing about that is that years ago I have played with that.
> My very strange finding was that I could best use veryfast. It was
> faster and created smaller files. But that is many years ago, so maybe
> that is not true anymore.

Until two years ago it was still the case:

https://write.corbpie.com/ffmpeg-preset-comparison-x264-2019-encode-speed-and-file-size/

I ran it with veryfast. It took about half the time and kb/s was 2164
instead of 2444. Better, but still about 40% higher as I would expect.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Michael Koch  writes:

> Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user:
>> I have to cut out a part of a video, crop it and blackout two parts.
>> I do this with:
>>  ffmpeg -y  \
>> -ss 00:19:49\
>> -i  2021-03-25ToastmastersClubAvond.mp4 \
>> -to 442 \
>> -vf "
>>  crop = 1440:1080:240:0
>>  ,
>>  drawbox=enable='between(t, 0, 2)' :
>> color = black  :
>> w = in_w   :
>> h = in_h   :
>> thickness = fill
>>  ,
>>  drawbox=enable='between(t, 339, 342)' :
>> color = black  :
>> w = in_w   :
>> h = in_h   :
>> thickness = fill
>> "   \
>> -acodec copy\
>> -vcodec libx264 \
>> -crf23  \
>> speechClean2.mp4
>>
>> The reason I do -to in the output is that in this way the metadata
>> concerning the video length is less out of whack.
>>
>> I was wondering if this is a good way, or that it could be done
>> better?
>> Also, beside the timestamps the parameters for drawbox are the same.
>> Is there a way that I do not have to repeat them?
>
> drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))'

Works like a charm.

Strange thing is that it seems to be much faster. About 20%. To much
to be because of different load I think.
But I am not complaining. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Nicolas George  writes:

> Carl Eugen Hoyos (12021-04-05):
>> There is a fundamental misunderstanding:
>> You decide how much quality you want to preserve, x264 decides how
>> much bitrate is needed to reach that quality.
>
> You also decide how much computing power you want to spend on it, which
> Cecil neglected to do. More computing power usually means lower bitrate
> for same quality. The keyword is "preset".

Yes, that was not smart.

The funny thing about that is that years ago I have played with that.
My very strange finding was that I could best use veryfast. It was
faster and created smaller files. But that is many years ago, so maybe
that is not true anymore.

Time to play with preset again.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Cecil Westerhof via ffmpeg-user
Carl Eugen Hoyos  writes:

>> Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user 
>> :
>> 
>> I have to cut out a part of a video, crop it and blackout two parts.
>> I do this with:
>>ffmpeg -y  \
>>   -ss 00:19:49\
>>   -i  2021-03-25ToastmastersClubAvond.mp4 \
>>   -to 442 \
>>   -vf "
>>crop = 1440:1080:240:0
>>,
>>drawbox=enable='between(t, 0, 2)' :
>>   color = black  :
>>   w = in_w   :
>>   h = in_h   :
>>   thickness = fill
>>,
>>drawbox=enable='between(t, 339, 342)' :
>>   color = black  :
>>   w = in_w   :
>>   h = in_h   :
>>   thickness = fill
>>   "   \
>>   -acodec copy\
>>   -vcodec libx264 \
>>   -crf23  \
>>   speechClean2.mp4
>> 
>> The reason I do -to in the output is that in this way the metadata
>> concerning the video length is less out of whack.
>> 
>> I was wondering if this is a good way, or that it could be done
>> better?
>
>> Also, beside the timestamps the parameters for drawbox are the same.
>> Is there a way that I do not have to repeat them?
>
> I suspect there is an „Or“ parameter for „enable“.
>
>> 
>> I started the crf with 16, then 20 and lastly 23.
>> 
>> The input file has:
>>Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
>> 1920x1080, 2070 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
>> 
>> With crf 16 I get:
>>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
>> 1440x1080, 5541 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
>> 
>> With crf 20 I get:
>>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
>> 1440x1080, 3538 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
>> 
>> And with crf 23 I get:
>>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
>> 1440x1080, 2444 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
>> 
>> So to me it seems that the crf value is still to high.
>
> You mean still too low?

Yes, bitrate is to high, so the crf value is to low. Silly me. ;-)


>> Is there a way
>> to use the kb/s to calculate the crf value to use?
>
> There is a fundamental misunderstanding:
> You decide how much quality you want to preserve, x264 decides how much
> bitrate is needed to reach that quality. (This is true for the general
> case where you want to control the output quality and are therefore
> using the crf option.)
> If you really have bitrate constraints, use two-pass encoding
> instead of the crf option.

I do not really have a bitrate constraint, but I would think a higher
bitrate as the input bitrate would be a waste. Because the crop
removes about a quarter I would think that a bitrate higher as 1500
would be a waste.


> I suspect the reason for the high bitrate of the output file is the low
> quality of the input file but this is not really relevant, just a
> (possible) explanation. One (unlikely) alternative is that your original
> h264 encoder is much better than x264.

That is what I mean: if the quality of the input is low, then there is
no use for going for a high(er) quality for the output.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Nicolas George
Carl Eugen Hoyos (12021-04-05):
> There is a fundamental misunderstanding:
> You decide how much quality you want to preserve, x264 decides how
> much bitrate is needed to reach that quality.

You also decide how much computing power you want to spend on it, which
Cecil neglected to do. More computing power usually means lower bitrate
for same quality. The keyword is "preset".

Regards,

-- 
  Nicolas George


signature.asc
Description: PGP signature
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Michael Koch

Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user:

I have to cut out a part of a video, crop it and blackout two parts.
I do this with:
 ffmpeg -y  \
-ss 00:19:49\
-i  2021-03-25ToastmastersClubAvond.mp4 \
-to 442 \
-vf "
 crop = 1440:1080:240:0
 ,
 drawbox=enable='between(t, 0, 2)' :
color = black  :
w = in_w   :
h = in_h   :
thickness = fill
 ,
 drawbox=enable='between(t, 339, 342)' :
color = black  :
w = in_w   :
h = in_h   :
thickness = fill
"   \
-acodec copy\
-vcodec libx264 \
-crf23  \
speechClean2.mp4

The reason I do -to in the output is that in this way the metadata
concerning the video length is less out of whack.

I was wondering if this is a good way, or that it could be done
better?
Also, beside the timestamps the parameters for drawbox are the same.
Is there a way that I do not have to repeat them?


drawbox=enable='bitor(between(t, 0, 2),between(t, 339, 342))'

Michael

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Cut part of a video, crop it and blackout parts of it

2021-04-05 Thread Carl Eugen Hoyos


> Am 05.04.2021 um 01:48 schrieb Cecil Westerhof via ffmpeg-user 
> :
> 
> I have to cut out a part of a video, crop it and blackout two parts.
> I do this with:
>ffmpeg -y  \
>   -ss 00:19:49\
>   -i  2021-03-25ToastmastersClubAvond.mp4 \
>   -to 442 \
>   -vf "
>crop = 1440:1080:240:0
>,
>drawbox=enable='between(t, 0, 2)' :
>   color = black  :
>   w = in_w   :
>   h = in_h   :
>   thickness = fill
>,
>drawbox=enable='between(t, 339, 342)' :
>   color = black  :
>   w = in_w   :
>   h = in_h   :
>   thickness = fill
>   "   \
>   -acodec copy\
>   -vcodec libx264 \
>   -crf23  \
>   speechClean2.mp4
> 
> The reason I do -to in the output is that in this way the metadata
> concerning the video length is less out of whack.
> 
> I was wondering if this is a good way, or that it could be done
> better?

> Also, beside the timestamps the parameters for drawbox are the same.
> Is there a way that I do not have to repeat them?

I suspect there is an „Or“ parameter for „enable“.

> 
> I started the crf with 16, then 20 and lastly 23.
> 
> The input file has:
>Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1920x1080, 2070 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
> 
> With crf 16 I get:
>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 5541 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
> 
> With crf 20 I get:
>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 3538 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
> 
> And with crf 23 I get:
>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1440x1080, 2444 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
> 
> So to me it seems that the crf value is still to high.

You mean still too low?

> Is there a way
> to use the kb/s to calculate the crf value to use?

There is a fundamental misunderstanding:
You decide how much quality you want to preserve, x264 decides how much bitrate 
is needed to reach that quality. (This is true for the general case where you 
want to control the output quality and are therefore using the crf option.)
If you really have bitrate constraints, use two-pass encoding instead of the 
crf option.

I suspect the reason for the high bitrate of the output file is the low quality 
of the input file but this is not really relevant, just a (possible) 
explanation. One (unlikely) alternative is that your original h264 encoder is 
much better than x264.

Carl Eugen
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Using Homebrew to install FFmpeg, But having wired problems.

2021-04-05 Thread Carl Eugen Hoyos


> Am 05.04.2021 um 04:39 schrieb Kosei Seki <1446513973wh...@gmail.com>:
> 
> (base) XXX-MacBook-Air ~ % brew install ffmpeg --HEAD

You will have to ask elsewhere (we are not brew) if you don’t like the links on 
our download page:
http://ffmpeg.org/download.html

Carl Eugen
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".