Hi
In Windows I am using this bat file - I either drag and drop a file on it or select a file and use sendto
c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name -i "%~dpnx1"
c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name -i "%~dpnx1"
pause
this is the output:
E:\>c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name -i "E:\Palookaville.mp4"
streams.stream.0.codec_name="aac"
E:\>c:\ffmpeg\bin\ffprobe -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name -i "E:\Palookaville.mp4"
streams.stream.0.codec_name="h264"
E:\>pause
Press any key to continue . . .
How do I create variable for streams.stream.0.codec_name="aac" and streams.stream.0.codec_name="h264"
Ideally I want variables for the audio codec name, in this case "aac" and for the video codec name, in this case "h264"
What I want to do is create a bat file that does the same thing as this Linux script - ffprobe.sh
#!/bin/bash
INFO=$(ffprobe -i "$1" -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams a:0 -show_entries stream=codec_name)
echo $INFO
b=${INFO:28}
if [[ "$b" == '"opus"' ]]; then codeca="ogg"; fi
if [[ "$b" == '"ac3"' ]]; then codeca="ac3"; fi
if [[ "$b" == '"aac"' ]]; then codeca="m4a"; fi
if [[ "$b" == '"mp3"' ]]; then codeca="mp3"; fi
echo demuxed audio file: "${1%.*}.$codeca"
INFO1=$(ffprobe -i "$1" -v quiet -of default=noprint_wrappers=0 -print_format flat -select_streams v:0 -show_entries stream=codec_name)
echo $INFO1
c=${INFO1:28}
if [[ "$c" == '"h264"' ]]; then codecv="m4v"; fi
if [[ "$c" == '"vp9"' ]]; then codecv="mkv"; fi
echo demuxed video file: "${1%.*}.$codecv"
ffmpeg -i "$1" -v quiet -vn -acodec copy "${1%.*}.$codeca"
ffmpeg -i "$1" -v quiet -an -vcodec copy "${1%.*}.$codecv"
$SHELL
In Linux, for the file[s] I want to process I use sendto [in the /usr/share/Thunar/sendto directory I have ffprobe.desktop ]
this is the output:
streams.stream.0.codec_name="aac"
demuxed audio file: /media/unoit/Backup/Palookaville.m4a
streams.stream.0.codec_name="h264"
demuxed video file: /media/unoit/Backup/Palookaville.m4v
TIA
+ Reply to Thread
Results 1 to 3 of 3
-
-
here is an example:
https://forum.videohelp.com/threads/412365-How-to-calculate-the-average-bitrate-of-video#post2712856
it can be done without creating temp files (if it is important) , check example below in the same thread:
https://forum.videohelp.com/threads/412365-How-to-calculate-the-average-bitrate-of-video#post2713099 -
@_Al_
Thanks for the heads up
This is my preliminary batch file - ffprobe.bat
ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
set "arg[0]=codec_name"
C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams v:0 -show_entries stream=%arg[0]% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >video.txt
C:\ffmpeg\bin\ffprobe.exe -v quiet -select_streams a:0 -show_entries stream=%arg[0]% -of default=noprint_wrappers=1:nokey=1 -i "%~dpnx1" >audio.txt
set /p codecv=<video.txt
set /p codeca=<audio.txt
if %codeca% == aac set myaudio=m4a
if %codeca% == ac3 set myaudio=ac3
if %codecv% == h264 set myvideo=m4v
if %codecv% == vp9 set myvideo=mkv
echo original file is "%~dpnx1"
echo demuxed audio is "%~dpn1.%myaudio%"
echo demuxed video is "%~dpn1.%myvideo%"
c:\ffmpeg\bin\ffmpeg -v quiet -i "%~dpnx1" -vn -c:a copy "%~dpn1.%myaudio%"
c:\ffmpeg\bin\ffmpeg -v quiet -i "%~dpnx1" -an -c:v copy "%~dpn1.%myvideo%"
pause
and the output is
E:\>ECHO OFF
original file is "E:\Palookaville.mp4"
demuxed audio is "E:\Palookaville.m4a"
demuxed video is "E:\Palookaville.m4v"
Press any key to continue . . .
Similar Threads
-
MystiQ - An open source FFmpeg GUI for Windows and Linux
By fdd in forum Video ConversionReplies: 0Last Post: 13th Nov 2022, 05:29 -
Cine Encoder 2021 (Windows/Linux)
By Helg1980 in forum Video ConversionReplies: 17Last Post: 11th Jun 2022, 11:42 -
Convert windows batch to linux
By che10 in forum LinuxReplies: 0Last Post: 16th May 2022, 18:08 -
Detect embedded closed captions in video stream using ffprobe json output
By ptr727 in forum Video ConversionReplies: 1Last Post: 14th Mar 2022, 09:56 -
[Linux] ffmpeg libx264 VS [Windows] x264: quality difference ?
By precipizio in forum Video ConversionReplies: 1Last Post: 4th Aug 2021, 03:05