Could not really decide where this question should go - but hope programming is a suitable place.
I need to view the text output from an ffmpeg query.
I have tried using the -report argument and yes it does print a .log file with a name such as "ffmpeg-20230825-211808.log"
However - the long file name and timestamp can be problematic for me to handle in a script. I would really like to force the ffmpeg code to re-route the text output to a text file with a name that I can specify.
Then I hope to grep that file for certain terms.
Or - even better - if at all possible I would like to directly grep the terms straight from the ffmpeg output.
The ffmpeg query and response is such as this:
Code: Select all
root# ffmpeg -report -f v4l2 -list_formats all -i /dev/video0
ffmpeg started on 2023-08-25 at 21:24:36
Report written to "ffmpeg-20230825-212436.log"
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --prefix=/usr --libdir=/usr/lib64 --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-pthreads --enable-small --enable-postproc --enable-libvorbis --enable-gpl --enable-shared --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-debug --enable-bzlib --enable-zlib --enable-libspeex --enable-version3 --enable-runtime-cpudetect --enable-libxcb --enable-libtheora --enable-libxvid --enable-swscale --enable-libvpx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[video4linux2,v4l2 @ 0x1be9fe0] Raw : yuyv422 : YUYV 4:2:2 : 640x400 640x480 320x240 320x200 160x120 1280x800 1280x720
[video4linux2,v4l2 @ 0x1be9fe0] Compressed: mjpeg : Motion-JPEG : 640x400 640x480 320x240 320x200 160x120 1280x800 1280x720
/dev/video0: Immediate exit requested
root#
The data I am really interested in is:
Raw : yuyv422 : YUYV 4:2:2 : 640x400 640x480 320x240 320x200 160x120 1280x800 1280x720
and:
Compressed: mjpeg : Motion-JPEG : 640x400 640x480 320x240 320x200 160x120 1280x800 1280x720
I have tried redirecting to a text file like this:
root# ffmpeg -report -f v4l2 -list_formats all -i /dev/video0 > formats.txt
- but the created file is empty.
Any thoughts appreciated!