[FFmpeg-user] Get sample rate in mp3 files

CMG DiGiTaL cmarciog at gmail.com
Mon Feb 7 15:55:11 EET 2022


Oi Reindl Harald,

Hi Reindl Harald,

ok, but the sample rate information is in :
Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 320 kb/s

What happens is that I don't know which command I use to compare only the
sample rate that is in the audio stream and manage to filter
the audio with only 48000 khz to another folder. That is, what command do I
use to read only the sample rate 48000 khz and be able to select it??

An example:
1 - Today, I have to enter the audios folder and through the mouse hint on
the file, see the sample rate and copy the file to another folder manually.
2 - After copying all the files with 48000 khz manually, I made a .bat file
to convert the sample rate from 48000 to 44100 khz and copy the converted
files to another folder, see the command below:

cd\Users\%username%\Desktop\*"Folder with 48000 khz files"*
for %%F IN (*) do ffmpeg -i "%%F" -map 0:0 -acodec mp3 -b:a 320k -ar:a
44100 "C:\Users\%username%\Desktop\*Converted*\%%F"

The bat works perfectly, but first I have to manually copy the files
to the *"Folder
with 48000 khz files"*, and that's exactly what I wanted to automate too!

Thanks
Clamarc


Em dom., 6 de fev. de 2022 às 22:29, Reindl Harald <h.reindl at thelounge.net>
escreveu:

>
>
> Am 07.02.22 um 02:25 schrieb CMG DiGiTaL:
> > Hi,
> > I'm creating a bat file that will access a folder with several mp3
> files. I
> > would like to be able to select in this folder only the mp3s with a
> sample
> > rate of 48000 khz and copy them to another folder where I will change
> from
> > 48000 khz to 44100 khz. What command can I use to select only 48000kHz
> mp3
> > from original folder to destination folder?  I will use ffmpeg in a batch
> > file.
>
> you need to parse the output the same way as for other infos
>
> Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 277 kb/s
>
> -----------------
>
> [harry at srv-rhsoft:/audio/Steve Vai/Inviolate]$ ffmpeg -i 'Steve Vai -
> Apollo In Color.mp3'
> ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
>    built with gcc 11 (GCC)
>    configuration: --prefix=/usr/local --bindir=/usr/local/bin
> --mandir=/usr/local/man
> --extra-cflags='-I/rpmbuild/BUILD/ffmpeg-20220201/x264-static -m64 -O2
> -g0 -march=sandybridge -mtune=sandybridge -mno-avx512f -mfpmath=sse
> -msse2avx -ftree-slp-vectorize -fopenmp -pipe -fno-strict-aliasing
> -fomit-frame-pointer -fexceptions -fno-asynchronous-unwind-tables
> -fstack-protector-strong --param=ssp-buffer-size=6
> -Wp,-D_FORTIFY_SOURCE=2 -w -Wformat -Werror=format-security -fPIC -O3
> -mno-avx512f -fno-strict-aliasing -fno-tree-vectorize
> -ftree-slp-vectorize -fno-gcse-after-reload -fno-inline-functions
> -fno-ipa-cp -fno-ipa-cp-clone -fno-peel-loops -fno-predictive-commoning
> -fno-tree-loop-distribute-patterns -fno-unswitch-loops -flto=8
> -fwhole-program -w'
> --extra-ldflags='-I/rpmbuild/BUILD/ffmpeg-20220201/x264-static
> -L/rpmbuild/BUILD/ffmpeg-20220201/x264-static -ldl -Wl,--as-needed
> -Wl,-z,now -Wl,-z,relro -m64 -O2 -g0 -march=sandybridge
> -mtune=sandybridge -mno-avx512f -mfpmath=sse -msse2avx
> -ftree-slp-vectorize -fopenmp -pipe -fno-strict-aliasing
> -fomit-frame-pointer -fexceptions -fno-asynchronous-unwind-tables
> -fstack-protector-strong --param=ssp-buffer-size=6
> -Wp,-D_FORTIFY_SOURCE=2 -w -Wformat -Werror=format-security -fPIC -O3
> -mno-avx512f -fno-strict-aliasing -fno-tree-vectorize
> -ftree-slp-vectorize -fno-gcse-after-reload -fno-inline-functions
> -fno-ipa-cp -fno-ipa-cp-clone -fno-peel-loops -fno-predictive-commoning
> -fno-tree-loop-distribute-patterns -fno-unswitch-loops -flto=8
> -fwhole-program -pie -fPIE -w' --ar=gcc-ar --ranlib=true --enable-lto
> --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvpx
> --enable-libx264 --enable-libx265 --enable-nonfree --enable-openssl
> --enable-pic --enable-runtime-cpudetect --enable-static
> --enable-version3 --disable-amf --disable-appkit --disable-autodetect
> --disable-avdevice --disable-avfoundation --disable-coreimage
> --disable-debug --disable-devices --disable-ffplay --disable-ffprobe
> --disable-htmlpages --disable-hwaccels --disable-iconv
> --disable-libdc1394 --disable-libfreetype --disable-libgsm
> --disable-libopencore-amrnb --disable-libopencore-amrwb
> --disable-libopencv --disable-libopenjpeg --disable-libopus
> --disable-librtmp --disable-libspeex --disable-libvorbis
> --disable-libxcb --disable-libxcb-shape --disable-libxcb-shm
> --disable-libxcb-xfixes --disable-libxvid --disable-podpages
> --disable-postproc --disable-protocol=gopher --disable-shared
> --disable-txtpages --disable-xlib
>    libavutil      57. 17.100 / 57. 17.100
>    libavcodec     59. 18.100 / 59. 18.100
>    libavformat    59. 16.100 / 59. 16.100
>    libavfilter     8. 24.100 /  8. 24.100
>    libswscale      6.  4.100 /  6.  4.100
>    libswresample   4.  3.100 /  4.  3.100
> Input #0, mp3, from 'Steve Vai - Apollo In Color.mp3':
>    Metadata:
>      title           : Apollo In Color
>      artist          : Steve Vai
>      album           : Inviolate
>      genre           : Instrumental Rock
>      date            : 2022
>    Duration: 00:04:18.84, start: 0.000000, bitrate: 277 kb/s
>    Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 277 kb/s
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list