I am using ffprobe on Windows to identify files. The command/parameters I use are:
ffprobe -show_entries format=format_name -v quiet filename
I noticed with certain image files ffprobe reports a different format if the file name has (or does not have) and extension. For example, for a BMP image file named XXX
ffprobe -show_entries format=format_name -v quiet XXX
reports
[FORMAT]
format_name=mp3
[/FORMAT]
But, if I rename the file to XXX.BMP and rerun the command
ffprobe -show_entries format=format_name -v quiet XXX.BMP
reports
[FORMAT]
format_name=image2
[/FORMAT]
Is this behavior expected? Has anyone else encountered this issue? I am using the most recent version of ffmpeg.
Related
I have a script that is currently using wget to grab an image from a url then passing that image to ffprobe. I'd like to remove the wget dependancy. What is the best way to download this image from the URL into STDIN so that ffprobe can read it.
Current logic is:
wget_command = "wget --header=\"ApiKey: #{#config.api_key}\" -O- #{file} | "
ffprobe_command = "ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 -i"
Open3.capture3("#{wget_command} #{ffprobe_command} -")
Other places in the script use Faraday for http requests so that is ideally what I would like to use to pull the image.
What is the best way to download this image from the URL into STDIN so
that ffprobe can read it.
ffprobe itself can get network resource, from ffprobe docs, your case is somewhat more complicated, but it should be possible if ffprobe does act in this are same way as ffmpeg which allows you to pass http headers, I suggest starting with following command
ffprobe -headers $'ApiKey: YOURAPIKEY' -i URLTOIMAGE -v trace
Good day!
I would like to know if there's a way to get Y/luma values in txt format
here it is the command line
-https://ffmpeg.org/ffmpeg-filters.html#Examples-105
https://ffmpeg.org/ffmpeg-filters.html#signalstats-1
and one more thing I would like to know the way to get all YUV min/max values at once
thanx
regards.
Use a less verbose log level and append the command with > output.txt:
ffprobe -loglevel error -f lavfi movie=input.mp4,signalstats -show_entries frame_tags=lavfi.signalstats.YMIN,lavfi.signalstats.YLOW,lavfi.signalstats.YAVG,lavfi.signalstats.YHIGH,lavfi.signalstats.YMAX,lavfi.signalstats.UMIN,lavfi.signalstats.ULOW,lavfi.signalstats.UAVG,lavfi.signalstats.UHIGH,lavfi.signalstats.UMAX,lavfi.signalstats.VMIN,lavfi.signalstats.VLOW,lavfi.signalstats.VAVG,lavfi.signalstats.VHIGH,lavfi.signalstats.VMAX > output.txt
You can change the output format with the -of option.
I am trying to extract the duration of a video (.MP4) using FFProbe and require that the result be output to a file.
FFProbe works perfectly and creates the file with the duration information when I enter it using the Command Prompt, however, when I place the same statement in my VB6 program, FFProbe does not create the output file..... What is the problem??
Here is the statement that works from the Command Prompt:
C:\Program Files\FFMpeg\bin>ffprobe -i InputVideo.mp4 -v quiet -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 > c:\temp\Output.txt
Here is the code snippet from my program that does not work:
Dim Txt As String
Dim AppId As Long
Dim AppHnd As Long
Dim AppRet As Long
Txt = "C:\Program Files\FFMpeg\bin>ffprobe" & _
" -i " & """" & PhotoPathFileName & """" & _
" -v quiet -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 >
""C:\temp\Output.txt"""
AppId = Shell(Txt, vbHide)
AppHnd = OpenProcess(SYNCHRONIZE, 0, AppId)
If AppHnd <> 0 Then
AppRet = WaitForSingleObject(AppHnd, WaitInfinite)
End If
We are making progress upon the suggestion from "wqw" to use cmd /c , I now get the output redirected to a file but not all the time.
This works because the video file name has no spaces:
cmd /k "C:\Program Files\FFMpeg\bin\ffprobe.exe" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -i \\DLINK\Volume_1\Movies\Arrow.mp4 > c:\temp\Duration.txt
This does NOT work:
cmd /k "C:\Program Files\FFMpeg\bin\ffprobe.exe" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -i \\DLINK\Volume_1\Movies\Generation Earth Part 1.mp4 > c:\temp\Duration.txt
It appears that cmd /c has some problems handling spaces in file name even if I surround them with double quotes. Also UNC filenames are not supported by cmd but ffprobe handles them OK. Still working on the problem, Thank you.
Ok, I got it working finally.
Using cmd /c I found that if you changed to the directory of ffprobe first, then executed ffprobe, the mishandling of double quotes is avoided:
cmd /c cd C:\Program Files\FFMpeg\Bin & ffprobe {paramters} > output.txt
Somewhat similar problem with ffprobe in Linux for me.
I found that ffprobe doesn't write to standard output
but instead to standard error. So, use the "2>" syntax to
capture standard error to a file.
# ffprobe test.mkv 2>target.txt
# cat target.txt
Input #0, matroska,webm, from 'test.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
...
Probably because of admin rights. Try using ShellExecute.
See this post
or this one
I'm currently running the following command and it's giving me mostly what I need, but I would like to also have it include the file name.
for %%A IN (%VAR0%\*.wav) DO "C:\program files (x86)\ffmpeg\bin\ffprobe" -i "%%A" -show_entries format=duration -v quiet -of csv="p=0" >>output.txt
The above produces this:
110.994375
This is great, but what I would really want is something like this as I need to import this data into a db for further processing. I need to know which file the 110.9943765 came from.
recording1.wav, 110.994375
Thanks,
Steven
All you need is to add the filename key as well.
ffprobe -i "%%A" -show_entries format=filename,duration -v quiet -of csv="p=0" >>output.txt
I am trying to make an FFMPEG script that relied on a glob input pattern from Linux to Windows. Unfortunately that is not supported so I am looking for an alternative. I do not want to have to rename or copy the files every time I run the script because the files are used elsewhere and I cannot rename them and I would like to avoid duplication or unnecessary temporary files.
Are globs numerically sequential named images my only option here? Ideally I would like to input a list of image paths to FFMPEG as a substitute for ffmpeg -i *.jpg
The workarounds are to prepare a text file with the names and use the concat demuxer.
Or you can use image2pipe
cat *.jpg | ffmpeg -f image2pipe -framerate 25 -i - out.mp4
The best solution I could find (that's Windows compatible) was to generate a line separated list of files in a text file and pass that through to FFMPEG. For example, to generate a stabilized MP4 from a bunch of JPEGs:
ffmpeg -f concat -safe 0 -i ./files.txt -vf deshake=rx=64:ry=64 ./stabilized.mp4
Where files.txt is a list of the files in the following format. The safe option toggles the ability to have absolute/relative file paths.
# this is a comment
file 'C:/path/to/file1.jpg'
file 'C:/path/to/file2.jpg'
file 'C:/path/to/file3.jpg'