7

Without editing and recompiling ffmpeg from source, how can one hide some of the many lines that it prints when it starts encoding, without also hiding its progress bar that updates every second or so while encoding?

Progress bar:
frame=14759 fps=3226 … bitrate=8509.2kbits/s speed= 108x

Typical command:
ffmpeg -hide_banner in.mov out.mp4

Typical noise: a dozen or more lines like

  Duration: 00:59:19.45, start: 0.257200, bitrate: 9623 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, bottom first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:2[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (pcm_dvd (native) -> ac3 (native))

These attempts hide Stream, but also hide the progress bar (because it never reaches egrep, because of \r instead of \n?):

stdbuf -i0 -o0 -e0 ( ffmpeg … 2>&1 ) | grep -v Stream

unbuffer ffmpeg … | unbuffer grep -v Stream

Replace grep with something inherently unbuffered?
sed -u /Stream/d hides the progress bar, too.

Related: https://stackoverflow.com/questions/3465619/how-to-make-output-of-any-shell-command-unbuffered

Really complicated possible approach: https://unix.stackexchange.com/questions/330636/how-to-grep-in-real-time-an-output-containing-a-progress-bar

2 Answers2

10
ffmpeg -v quiet -stats -i in.mov out.mp4

No need to use -hide_banner flag.

5

Lower loglevel to warning/24 but hide banner and expressly enable stats.

ffmpeg -hide_banner -v warning -stats -i in.mov out.mp4
Gyan
  • 38,955