'Cannot grep out status line (terminal playback time) from mpv

essentially I'm trying to just run mpv on a video, and after you quit you get some information about the video.

Example:

 (+) Video --vid=1 (*) (hevc 1920x1080 60.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:01 / 00:12:32 (0%) A-V:  0.000

Exiting... (Quit)

I would like to grep out the AV line, however this line is added before/afterwards (I'm not exactly sure). When running mpv video_file | grep AV The video would play and the terminal would give this little status line

(Paused) AV: 00:00:02 / 00:00:57 (5%) A-V: 0.000 (random example video, different to the first one)

However after closing mpv there is no output, and its further confirmed when running

mpv video_file >> test.txt

giving an output of

 (+) Video --vid=1 (*) (hevc 1920x1080 60.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p

Exiting... (Quit)

suggesting that it places the AV line outside of the output, between VO line and the space line.

Soooo like how would I grep out this line?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source