Re: [FFmpeg-user] Average a "rolling" N frames?

2022-04-21 Thread Paul B Mahol
On Thu, Apr 21, 2022 at 7:03 AM Steven Kan  wrote:

> I’m putting together a time-lapse video of bees building comb in the hive.
> I have 5,000+ jpgs (and growing!) in a directory that I process with:
>
> ffmpeg -hwaccel videotoolbox -framerate 60 -pattern_type glob -i '*.jpg'
> -c:v h264_videotoolbox -b:v 100M CombLapse.mp4
>
> which results in:
>
> https://www.youtube.com/watch?v=CvGAHWVcbwY
>
> Someone suggested that I try to “remove the bees” and get video of just
> the comb. Which got me thinking, what if I could do a rolling average of,
> say, 100 frames? So frame 1 of my output would be the average of frames 1 -
> 100, and frame 2 of my output would be the average of frames 2 - 101, etc.
>
> I’ve used -vf tmix=frames=10:weights=“1” to take 10 frames of input and
> output 1 frame, but what syntax could I use to do a rolling average?


tmix by default does rolling average if you use no other filters.


>
>
> Or would I have to loop through the jpgs twice? Once to get 4,900 averaged
> stills and then another run to combine those into my video?
>
> ___
> 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 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] Hardware acceleration for converting PNGs into VP9

2022-04-21 Thread Klimek, Denis
Hi,

thanks for your help - Looks like that I have to get an newer Intel CPU before 
thinking about improvements.
Current system does not have any Quick Sync or other graphic hardware 
accelerations implementations. 

I will try it on my personal PC at home in the upcoming weeks - this has a new 
Intel CPU built in.

Thanks! 😊

Mit freundlichem Gruß
wilhelm.tel GmbH 
 
Denis Klimek
 
Carrier Manager & Professional Network Engineer
IP-Systemtechnik
 
Tel:+49 (0) 40 / 521 04 – 1049 -> Work From Home
Mobil: +49 (0) 151 / 652 219 06

dkli...@stadtwerke-norderstedt.de
www.wilhelm-tel.de

__ 



Postanschrift:
wilhelm.tel GmbH
Heidbergstraße 101-111
22846 Norderstedt

Geschäftsführer: Jens Seedorff, Theo Weirich
Vorsitzender des Aufsichtsrats: Christoph Mendel
Handelsregister: HRB 4216 NO, Amtsgericht Kiel
Umsatzsteuer ID: DE 81 299 7663



-Ursprüngliche Nachricht-
Von: ffmpeg-user  Im Auftrag von Dennis Mungai
Gesendet: Mittwoch, 20. April 2022 23:36
An: FFmpeg user questions 
Betreff: Re: [FFmpeg-user] Hardware acceleration for converting PNGs into VP9

On Wed, 20 Apr 2022 at 14:22, Klimek, Denis < 
dkli...@stadtwerke-norderstedt.de> wrote:

> Hi there,
>
> I’ve got an question regarding conversation from multiple PNGs into a 
> VP9 movie. Currently we are doing this job with our CPU and this is 
> quite slow… about 2.5fps in average and we have multiple movies to create 
> every hour.
> My idea was to accelerate it via an dedicated graphic card which can 
> be installed into our server to speed this things up.
>
> Which graphic card can handle this work for me and which parameters or 
> additional software pieces are required? (Vendor, Model)
>
> My current system is an Ubuntu 22.04 LTS 64bit and this is our current 
> command line which converts the PNGs to an VP9:
> ffmpeg -y -r 4.86 -pattern_type glob -i $DIR'/*.png' -c:v libvpx-vp9 
> -b:v
> 0 -crf 30 -row-mt 1 -pix_fmt yuva420p -threads 8 -slices 16 -f webm 
> $WORKINGDIR'/'$DIR'.webm.tmp'
> (Codeline is snipped from a bash script which fills the variables with 
> the necessary values)
>
> Thanks for advance for any help 😊
>
> Mit freundlichem Gruß
> wilhelm.tel GmbH
>
> Denis Klimek
> Carrier Manager & Professional Network Engineer IP-Systemtechnik
> Tel:+49 (0) 40 / 521 04 – 1049 -> Work From Home
> Mobil: +49 (0) 151 / 652 219 06
>
> dkli...@stadtwerke-norderstedt.de
> www.wilhelm-tel.de
>
> __
>
> [cid:image005.png@01D854B9.A6B5E0D0]
>
> Postanschrift:
> wilhelm.tel GmbH
> Heidbergstraße 101-111
> 22846 Norderstedt
>
> Geschäftsführer: Jens Seedorff, Theo Weirich Vorsitzender des 
> Aufsichtsrats: Christoph Mendel
> Handelsregister: HRB 4216 NO, Amtsgericht Kiel Umsatzsteuer ID: DE 81 
> 299 7663
>
> [ig][fb]<
> https://www.facebook.com/wilhelmtel.norderstedt/>
>
>
>
Hello there,

The closest you can get would be with either:

1. Intel's VP9 encoder wrappers for VAAPI and QuickSync (with IceLake IGPs and 
above), and this is only supported on Linux (at the moment).
The QSV encoder wrapper for VP9 isn't yet functional on Windows on any tested 
hardware. VAAPI is also only available on Linux.
For the VP9 QSV encoder wrapper usage, see
https://superuser.com/a/1644371/473795 for a good starting point with known 
limitations.
For the VP9 VAAPI encoder wrapper usage, see
https://stackoverflow.com/a/55036502/4675388 , and there are some known 
limitations with that encoder too.
I'll retest this and report back as soon as I have access to Intel's (release 
or engineering sample silicon's) Xe and Arc GPU products, in (both discrete 
and) integrated where available.
Expect a transition towards OneVPL (from QuickSync) for these workloads as from 
Intel's CometLake (10th Generation) and newer, and Intel Atom X moving forward. 
See 
https://www.intel.com/content/www/us/en/developer/articles/technical/onevpl-codecs-for-intel-hardware.html
for more details.

*Special notes:* 7th Generation KBL (Kabylake) GPUs have support for VP9 
encoding wired up and available via VAAPI and *unofficially* via the 
media-driver package patched with the approriate hybrid encode mode enabled, 
see https://github.com/sreerenjb/media-driver/tree/vp9-enc-gen9-vme-pak
However, this comes with multiple caveats, as noted on these PRs and issues:
(a). https://github.com/intel/intel-vaapi-driver/pull/209
(b). https://github.com/intel/intel-vaapi-driver/issues/87
Which resulted in this decision not to wire up the functionality (by
default) in the media-driver package:
https://github.com/intel/media-driver/issues/630#issuecomment-495498209

2. On Mac OSX:

There is potential for VP9 hardware-accelerated encoding via videotoolbox in 
future(?) M-series chips, considering that we now have H/W accelerated decoding 
for the same, see
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/a41a2efc85f8c88caec10040ee437562f9d0b947
.
Wouldn't bet too 

[FFmpeg-user] How to extract all the pictures but no repeat in an mp4 video file?

2022-04-21 Thread mikelee164396
I want to extract all the pictures in an mp4 video file , but don't repeat it. 
How to implement it with ffmpeg?


___
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] Large Sized output files recieved while encoding the audio

2022-04-21 Thread Shubham Tiwari
Thanks for all the inputs, I have a better understanding of the problem
now. The input audio is highly compressed. While applying the filter,
ffmpeg is converting the audio based on the fileformat of the output file.
If the output file provided is wav format, the resulting file is 1536 kb/s
uncompressed cbr, hence the large file size. If the output file provided is
of mp3, mka or opus(same as the input file), then conversion of the
resulting file is taking longer.

Does ffmpeg always convert the audio file while running the filter? if not,
in what cases does it skip the conversion?

The things I tried based on the inputs:
1. ffmpeg -i call.wav -af "volume=enable='between(t,0,1)':volume=0"
-c:a copy output.mka - does not work, error: filtering and streamcopy
cannot be used together.
2. ffmpeg -i call.wav -af "volume=enable='between(t,0,1)':volume=0"
-c:a libopus output.mka - In this case conversion is happening. resulting
file size is 10mb(under expected range) but the execution time is high due
to conversion

PS: I am having discussions with the team about hiring a specialist. will
keep posted about it.

Regards,
Shubham
___
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] Choppy video when recording/streaming desktop/games with mesa drivers if i set fps below 60

2022-04-21 Thread KoreanFanOfficial
I got choppy video when recording desktop with mesa drivers with fps below
60. With code like this i got choppy video:
ffmpeg -y -r 25 -window_id 0x540002e -vaapi_device /dev/dri/renderD128 -f
x11grab -i :0 -f alsa -i default -c:v h264_vaapi -vf
"hwupload,scale_vaapi=1280:720:format=nv12" -b:v 2500k -maxrate 2500k
-minrate 2500k -bufsize 3750k -c:a mp3 -b:a 128k -f flv 3.flv

ffmpeg -y -r 25 -window_id 0x560002e -vaapi_device /dev/dri/renderD128 -f
x11grab -i :0 -f alsa -i default -c:v h264 -vf
"hwupload,scale_vaapi=1280:720:format=nv12,hwdownload,format=yuv420p"
-preset ultrafast -b:v 2500k -maxrate 2500k -minrate 2500k -bufsize 3750k
-c:a mp3 -b:a 128k -f flv 3.flv

ffmpeg -y -r 25 -window_id 0x560002e -f x11grab -i :0 -f alsa -i default
-c:v h264 -vf "scale=1280:720,format=yuv420p" -preset ultrafast -b:v 2500k
-maxrate 2500k -minrate 2500k -bufsize 3750k -c:a mp3 -b:a 128k -f flv 3.flv

But if i use amdgpu-pro drivers with those codes for record i got perfect
video, no choppy. I also tested amf encoder with vaapi accel and there were
no choppy video.

But with mesa drivers, if i set fps 60 or more i got video without
chopping, but 60 fps or more eat more resources.
If i set fps with framerate command instead of r then i got same results or
xorg can crash and i will be logged out of system and stuck in logscreen or
i can got choppy video with 1-2 fps.
Please, help me.
System: debian,ubuntu,arch,manjaro
video:amd card
___
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] Large Sized output files recieved while encoding the audio

2022-04-21 Thread Carl Zwanzig

On 4/21/2022 8:38 AM, Shubham Tiwari wrote:

Does ffmpeg always convert the audio file while running the filter? if not,
in what cases does it skip the conversion?


Most (all?) filters must operate on uncompressed data, so it depends 
entirely on what filters are being used-


https://ffmpeg.org/ffmpeg-all.html#Detailed-description tells us:
"ffmpeg calls the libavformat library [...] to read input files and get 
packets containing encoded data from them. [...]


Encoded packets are then passed to the decoder (unless streamcopy is 
selected for the stream, see further for a description). The decoder 
produces uncompressed frames (raw video/PCM audio/...) which can be 
processed further by filtering (see next section). After filtering, the 
frames are passed to the encoder, which encodes them and outputs encoded 
packets. Finally those are passed to the muxer, which writes the encoded 
packets to the output file."



If you are converting from one encoding to another (e.g. opus to mp3), the 
data must be decoded/uncompressed in order to re-encode to the other.


If a filter makes any change to the raw data (like adjusting the volume 
level), the data must be decoded/filtered/re-encoded so the filter can 
modify it.



Remember that -container- and -encoding- are different things; as shown, a 
wav container is holding opus encoding but usually it holds PCM/un-encoded 
audio. A Matruska container (mkv/mka) can hold a lot of different encodings. 
It's possible to copy an encoded stream between compatible containers, but 
that's an exact -copy-.



All of this is in the existing ffmpeg documentation.

z!
___
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] Fluorescent White Balance Video Filters

2022-04-21 Thread Michael Koch

Am 21.04.2022 um 04:25 schrieb Roger:

...

You can make your own LUT, as described in chapter 2.28 in my book.
-- Extract one frame from your video.
-- Insert a haldclut in a corner of the image, or use xstack to attach it to
the side.
-- Use the program of your choice to correct the colors in this image. When
done, save it lossless as 16-bit PNG.
-- Use FFmpeg to separate the haldclut from the image.
-- Apply the LUT to the whole video.

Michael

Sorry.  I had a little difficulty with understanding the text within the
Chapter 2.28.  Just couldn't scan and understand easily.  Although I thoroughly
understand SH/Bash, the variable assignments for simple filenames also slowed
reading, as I had to scan/reference back to the top of the page for the
definition/intent of the variable used.  Easier understanding for the reader to
read, "input_video.ext" and "output_video.ext", or use a similar named variable
such as $_input_video.ext and $_output_video.ext. Note: using a prefixed
underscore within SH/Bash variables separates/isolates from any possible
conflicts.  Heard of using this syntax from the Bash mailing list when doing C
style defines in SH/Bash.  However, for the sake of easy readability for
readers, it's probably best to use simple non-isolated variables.


My examples are for Windows batch files. For example, the line

set "IN=P100.mov"

sets the variable IN to the value P100.mov

If this variable is used in the command line, for example

ffmpeg -i %IN% -vf crop=...

then %IN% will be replaced by the filename, so that the command line for 
ffmpeg becomes


ffmpeg -i P100.mov -vf crop=...

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] How to extract all the pictures but no repeat in an mp4 video file?

2022-04-21 Thread Moritz Barsnick
On Thu, Apr 21, 2022 at 22:28:36 +0800, mikelee164396 wrote:
> I want to extract all the pictures in an mp4 video file , but don't repeat 
> it. How to implement it with ffmpeg?

For example:
$ ffmpeg -i inputvideo -vsync passthrough outputimage.%05d.jpg

Cheers,
Moritz
___
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] custom codec

2022-04-21 Thread Moritz Barsnick
On Tue, Apr 19, 2022 at 20:28:57 -0700, Right On wrote:
> hi - i was wanting to encode a video using the amv4
>  codec. this codec is currently
> not supported in ffmpeg - is there a way to add it? it's installed to my
> computer so i assumed there would be a way to call it but it doesn't come
> up when i run ffmpeg - encoders

No, ffmpeg cannot use arbitrary DLL codecs.

If I remember correctly, mencoder was able to do this, but possibly
only for a set of known codec DLLs.

Moritz
___
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] Average a "rolling" N frames?

2022-04-21 Thread Steven Kan
> On Apr 21, 2022, at 12:03 AM, Paul B Mahol  wrote:
> 
> On Thu, Apr 21, 2022 at 7:03 AM Steven Kan  wrote:
> 
>> I’m putting together a time-lapse video of bees building comb in the hive.
>> I have 5,000+ jpgs (and growing!) in a directory that I process with:
>> 
>> ffmpeg -hwaccel videotoolbox -framerate 60 -pattern_type glob -i '*.jpg'
>> -c:v h264_videotoolbox -b:v 100M CombLapse.mp4
>> 
>> which results in:
>> 
>> https://www.youtube.com/watch?v=CvGAHWVcbwY
>> 
>> Someone suggested that I try to “remove the bees” and get video of just
>> the comb. Which got me thinking, what if I could do a rolling average of,
>> say, 100 frames? So frame 1 of my output would be the average of frames 1 -
>> 100, and frame 2 of my output would be the average of frames 2 - 101, etc.
>> 
>> I’ve used -vf tmix=frames=10:weights=“1” to take 10 frames of input and
>> output 1 frame, but what syntax could I use to do a rolling average?
> 
> 
> tmix by default does rolling average if you use no other filters.

LOL; thanks! I should have RTFM before posting. Anyway, the results are 
amazing. For your esteemed review, here is the result of tmix:

1) The original with 1 frame per frame:

https://www.youtube.com/watch?v=CvGAHWVcbwY

2) The result of a 10-frame rolling average, tmix=frames=10:weights="1":

https://www.youtube.com/watch?v=2dUGbGcGE2c

2) The result of a 50-frame rolling average, tmix=frames=50:weights="1":

https://www.youtube.com/watch?v=aiBw7rAVC7k

Besides the surreal visuals, the other benefit is that it’s not really affected 
by YT's “compression crush,” since the bees are reduced to ghosts anway, and 
the comb is pretty much static.

Which is the most visually compelling?
___
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".