could use some help on ffprobe - cmd

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

Related

Pass image to STDIN for ffprobe to read in Ruby

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

CMD equivalent of linux wc -l command within a call to FFPROBE? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
This answer would solve a lot of my problems but relies on wc -l to tally the number of audio channels from the output of ffprobe.
How do I use ffmpeg to merge all audio streams (in a video file) into one audio channel?
I'm using a Windows batch file, so I need another way of accomplishing the following in CMD:
-filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 input.mov | wc -l),atempo=24000/24024[audio]"
Any help? My programming experience is minimal. This question seems like it's asking the same thing, but I can't seem to adapt its suggestions into the ffprobe call with the end result being it just returning a number.
What is the windows equivalent of Linux command wc -l?
This is untested as I don't have your programs installed. But essentially what you need to do is capture the output of ffprobe with a FOR /F command. You will pipe the output of FFPROBE to the FIND command to get a non empty line count.
FOR /F "delims=" %%G in ('ffprobe -loglevel error -select_streams a -show_entries stream^=codec_type -of csv^=p^=0 input.mov ^| find /v /c ""') do set "count=%%G"
You can then use the variable %count% with your FFMPEG command.

Output luma and chroma data in txt format

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.

FFProbe won't output result to a file

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

ffprobe reports different format depending on file extension

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.

Resources