[FFmpeg-user] write time and date to error message

Jonathan Baecker jonbae77 at gmail.com
Sun Nov 13 14:38:02 EET 2016


> Calling the program "date" on every line of output is likely to be too
> slow. You need a wrapper in a language which has its own
> gettimeofday(). I'm sure such wrappers already exist (I have even
> written my own in Perl actually). Check this:
>
> http://stackoverflow.com/q/21564/3974309
Thanks for your help! Yes, I believe is not the best to call date every 
time, and in my case it doesn't work to because it get call only the 
first time. I found now a solution with gawk:

ffmpeg [command] | tee >( awk '{ if ( $0 ~ /^\[mp/ || $0 ~ /^Error/ ) 
print "[" strftime("%F %T") "] " $0; else if ($0 !~ /^frame=/ ) print; 
fflush() }' >> ffreport.log )

It works, but a native solution in ffmpeg would be nice to.

Regards

Jonathan



More information about the ffmpeg-user mailing list