On 13-05-2019 12:36 AM, Thomas Seilund wrote:

On 12/05/2019 19.25, Gyan wrote:


On 12-05-2019 10:43 PM, Thomas Seilund wrote:
Hi All

I capture video stream from webcam and show video on screen.

The same stream goes through the 'metadata' multimedia filter as shown below:

ffmpeg -y -f v4l2 -input_format mjpeg -s hd480 -r 30 -i /dev/video2 -filter_complex "[0:0]select='gte(scene,0)',metadata=print:file='movement.txt',null[X]" -map '[X]' -pix_fmt yuv420p -f xv Title

The text file 'movement.txt' gets information about each frame. BUT data is written to text file 'movement.txt' buffered. Is there any way to write data to text file 'movement.txt' as each frame is processed?

Not at present. The file protocol will buffer up to 256 kB and then write out. There is an option to write immediately but it isn't applied to the metadata filter as its I/O context is isolated. I plan to patch that soon-ish.

Gyan
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Thanks Gyan.

Is there another way to get the metadata, ie. lavfi.scene_score, as the frame is processed?

Basically, I want to take some action when there is motion in the video!

If you increase the log level to debug or higher, you should see lines of the form

[Parsed_select_0 @ 00000000006feb80] n:1524.000000 pts:780288.000000 t:60.960000 key:0 interlace_type:P pict_type:B scene:0.000987 -> select:1.000000 select_out:0

The "scene:" value is what you want.

To capture this, you either redirect stderr to a file or add -report to your command. The latter will generate a text file in PWD.

Gyan
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to