Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques ffmpeg online logging

  • ffmpeg online logging

    Posted by Laurent Nguyen on July 4, 2011 at 2:05 pm

    Dear forum,

    I am trying to acquire process information at the frame level. I am encoding from a batch of still images, so my goal is to give a frame to ffmpeg , and then check the progress information to see if it is done encoding the frame or not.

    I could get this information offline using -vstats_file or -vstats and the file that is created looks like this:

    frame= 1 q= 1.0 f_size= 34754 s_size= 34kB time= 0.040 br= 6950.8kbits/s avg_br= 6950.8kbits/s type= I
    frame= 2 q= 1.0 f_size= 6775 s_size= 41kB time= 0.080 br= 1355.0kbits/s avg_br= 4152.9kbits/s type= P
    frame= 3 q= 1.0 f_size= 5974 s_size= 46kB time= 0.120 br= 1194.8kbits/s avg_br= 3166.9kbits/s type= P
    frame= 4 q= 1.0 f_size= 7406 s_size= 54kB time= 0.160 br= 1481.2kbits/s avg_br= 2745.4kbits/s type= P
    frame= 5 q= 1.0 f_size= 5955 s_size= 59kB time= 0.200 br= 1191.0kbits/s avg_br= 2434.6kbits/s type= P

    My ffmpeg call:
    ffmpeg -f image2 -r 25 -y -s vga -pix_fmt rgb24 -i RGB/im%5d.ppm -an -vcodec mpeg4 -qscale 1 rgb.mov -vstats_file log.txt

    How do I get this information in real time, i.e. every time a frame is processed ? I tried to read from the file, but ffmpeg seems to be writing chunks.

    I hope someone can help me ! Best regards,

    Laurent

    Michael Rampe replied 15 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Michael Rampe

    July 4, 2011 at 9:55 pm

    [Laurent Nguyen] “How do I get this information in real time, i.e. every time a frame is processed ? I tried to read from the file, but ffmpeg seems to be writing chunks.”

    I certainly have experienced this one before. I use the -vstats feature and get it to write to a named pipe (mkfifo). I then use this “live” to produce a graph of the results whilst it is encoding (ie. ffmpeg & sed & gnuplot). What I have found is that the output is buffered to 1024 bytes so as you said, it only writes in chunks.

    IIRC, I did some hunting once a while back in the source (ffmpeg.c) and found a buffering option (char buf[1024];) for this but gave up before getting it to work due to lack of C knowledge on my part.

    Certainly worth revisiting though. Let me know if you find a workable solution. It would make you a legend in my mind;-)

    Michael

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy