VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. HI
    I'm trying to write a TXT file with the luma level frame by frame of a MPEG file.
    Is possible with FFMPEG or another software?

    Thanks in advance.
    Quote Quote  
  2. Of course but you may try something else too: http://forum.doom9.org/showthread.php?t=174951 (ffmpeg links at bottom).
    Quote Quote  
  3. AviSynth's ColorYUV(analyze=true) will show the min, max, and average luma for each frame. It also shows the "loose min/max" values which excludes a small fraction of the lowest and highest values (typically noise). It also reports all those values for the U and V channels.

    But you'll have to install AviSynth, a third party source filter (LSmash or DGMpegDec), and learn some basic scripting -- it's a plain text based scripting language. A simple script may look like:

    Code:
    LWlibavVideoSource("filename.mpg") # open the video
    ColoryUV(analyze=true) # show statistics
    Then you open the script as if it was a video file with a media player or editor that supports AviSynth scripts. VirtualDub works well for that.

    Click image for larger version

Name:	coloryuv.jpg
Views:	38
Size:	86.0 KB
ID:	43407

    I don't know exactly what your purpose is but a waveform monitor is generally more useful once you know what it means:

    Click image for larger version

Name:	waveform.jpg
Views:	38
Size:	140.7 KB
ID:	43408

    See: https://forum.videohelp.com/threads/340804-colorspace-conversation-elaboration#post2121568

    Most video editors have such a display. Sony Vegas, for example.
    Last edited by jagabo; 18th Oct 2017 at 07:45.
    Quote Quote  
  4. Hi jagabo
    I would write the luma values in a TXT file.
    Is possible with AviSynth?

    Thanks
    Quote Quote  
  5. Yes, a script like:

    Code:
    LWlibavVideoSource("filename.mpg") # open the video
    WriteFile("log.txt", "current_frame", """ ":  " """, "YPlaneMin()", """ "  " """, "AverageLuma()", """ "  " """, "YPlaneMax()")
    Will write the frame number, luma min, luma average, and luma max values to "log.txt". Sample output from a dark video I was using for something else:

    Code:
    0:  18  43.566303  76
    1:  18  44.037815  77
    2:  18  44.120975  77
    3:  18  44.077927  76
    4:  18  44.195461  76
    5:  18  44.211269  73
    6:  18  44.253765  74
    7:  18  44.409962  71
    8:  18  44.315586  66
    9:  18  44.463371  67
    10:  18  44.581181  61
    11:  18  44.803864  61
    12:  18  44.746212  65
    13:  18  44.508266  63
    14:  18  44.228722  63
    15:  18  44.386868  62
    http://avisynth.nl/index.php/WriteFile
    Quote Quote  
  6. Very good.
    Last question:
    Is possible with FFMPEG o other program save a the video graph in a jpg o png?

    Thanks
    Quote Quote  
  7. Originally Posted by barabba2005 View Post
    Very good.
    Last question:
    Is possible with FFMPEG o other program save a the video graph in a jpg o png?

    Thanks
    Generally yes but it is not clear to me what is video graph...
    Quote Quote  
  8. Thanks for help
    I'm trying a result like this, not for audio but for video:

    ffmpeg -i input.mov -af astats=metadata=1:reset=1,ametadata=print:key=lavf i.astats.Overall.RMS_level:file=log.txt -f null -

    A file log.txt with video values
    Last edited by barabba2005; 19th Oct 2017 at 02:54.
    Quote Quote  
  9. Originally Posted by barabba2005 View Post
    Thanks for help
    I'm trying a result like this, not for audio but for video:

    ffmpeg -i input.mov -af astats=metadata=1:reset=1,ametadata=print:key=lavf i.astats.Overall.RMS_level:file=log.txt -f null -

    A file log.txt with video values
    af is for audio filter - i thought that you searching for video statistic.
    Quote Quote  
  10. Yes.
    Have you some tips?
    Quote Quote  
  11. https://www.ffmpeg.org/ffmpeg-filters.html#signalstats-1

    Code:
    @ffmpeg -v quiet -stats -i "%1" -vf:? "signalstats,metadata=print:key=lavfi.signalstats.YAVG:file='v.%~n1.txt'" -af:? "astats=metadata=1:reset=1,ametadata=print:key=lavfi.astats.Overall.RMS_level:file='a.%~n1.txt'" -f null -
    Last edited by pandy; 19th Oct 2017 at 07:33.
    Quote Quote  
  12. Wow....
    Thanks a lot!!
    Quote Quote  
  13. Originally Posted by barabba2005 View Post
    Wow....
    Thanks a lot!!
    You welcome, btw i've modified slightly provided example - by adding ':?' to '-vf' i.e. '-vf:?' and '-af' i.e. '-af:?' - this create more flexible/universal ffmpeg behaviour (audio/video, audio only and video only files can be analysed within single ffmpeg - good for some automated file processing).
    Quote Quote  
  14. Originally Posted by pandy View Post
    [btw i've modified slightly provided example - by adding ':?' to '-vf'...this create more flexible/universal ffmpeg behaviour...
    Interesting! I have never seen this before. What does it do?
    Quote Quote  
  15. Originally Posted by raffriff42 View Post
    Originally Posted by pandy View Post
    [btw i've modified slightly provided example - by adding ':?' to '-vf'...this create more flexible/universal ffmpeg behaviour...
    Interesting! I have never seen this before. What does it do?
    Honestly i've discovered this today trying to verify above example - without this ffmpeg was able to calculate signal statistic if both components (audio and video) was present at the input (as there is video and audio filtering involved), without one of components ffmpeg ended with error - as i've used before selective filtering (you can filter only selected audio or video track by explicitly calling filter only for component such as -vf:3 ".." -af:7 ".." etc) so tried to use general '?' which allow ffmpeg to ignore missing component and it works - currently you can call vf for audio only input and it will be ignored by ffmpeg.
    This is very nice as seem lot of people struggle with ffmpeg on missing component behaviour - personally i think it should be some global option (flag?) implemented to ignore missing components .
    Seem this is more or less in-line with https://ffmpeg.org/ffmpeg-all.html#Advanced-options (need to check if it works for output mapping if component is not present on input - seem there is issue that in such case first component is reused on output).

    Sorry for above explanation - i'm not a programmer and ffmpeg is frequently "undocumented"...
    Quote Quote  



Similar Threads