awk examples

Add Date and Time to Each Line in ffmpeg Log with awk

When transcode video or catch bugs in live stream, sometimes it is necessary to log ffmpeg messages with also date and time. This is possible with awk.

 

Insert date and time to ffmpeg log messages using awk

Here we use test stream link from [3]. We run ffplay for check its work:

ffplay https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8 2>&1 | awk 'NF {print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush()}'

Explanation: