I comparing FFmpeg vs FFprobe to get total frame given input,
I found FFmpeg (using null output) count frame much faster then FFprobe,
So, there are way to count frame faster in FFprobe?
+ Reply to Thread
Results 1 to 7 of 7
-
-
what commandline are you using? ffmpeg will decode a/v, and be much slower than ffprobe (you can speed it up slightly if you disable audio -an)
you can use ffprobe to output the framecount directly, but they are not decoded, thus essentially instant. (In theory this might be less accurate than decoding frame by frame, so it depends what context you need this for)
ffprobe -i "INPUT.ext" -select_streams v:0 -show_entries "stream=nb_frames" -
Have you tried using the threads switch?
ffprobe -threads %NUMBER_OF_PROCESSORS%*1.5 -v quiet -pretty -print_format csv -select_streams v:0 -count_frames -show_entries "stream=nb_frames,nb_read_frames" -
Command-line i use is:
Code:ffmpeg.exe -i "D:\Users\Anime4000\Videos\Raptr\Company of Heroes 2\2015_12_08_22_05_18-man.mp4" -map 0:0 -vcodec copy -f null - 2> gg.txt
I can say using ffprobe very-very slow, it took 10 minute! meanwhile ffmpeg.exe just 33 second! -
When you use -vcodec copy, the frames are not decoded or counted individually, thus very fast. Remove the -vcodec copy and it will decode and count them frame by frame
IF you use ffprobe in the mode described above, it will be as fast or faster than ffmpeg. That's equivalent to -vcodec copy (ie. in that mode it doesn't decode frames individually) .
The faster method for either ffmpeg or ffprobe, in theory can give you errors , as it doesn't count them frame by frame. So again, it depends on the context or why you are doing this -
Code:
ffprobe -i "INPUT.ext" -select_streams v:0 -show_entries "stream=nb_frames"
since no -count_frames
Code:ffprobe -threads %NUMBER_OF_PROCESSORS%*1.5 -v quiet -pretty -print_format csv -select_streams v:0 -count_frames -show_entries "stream=nb_frames,nb_read_frames"
This because I ran multi pass x265, when I give wrong frame count, x265 cannot continue... -
Best method:
Cmd ->
ffprobe.exe -v error -select_streams v:0 -show_entries stream=r_frame_rate,duration -of default=nw=1 "d:\movies\The.Matrix.1999.1080p.BrRip.x264.YIFY.d ut.mp4"
Result ->
r_frame_rate=24000/1001
duration=8177.794625
Calculation ->
Frames=24000/1001*8177.794625=196071
Proof ->
ffmpeg -i "d:\movies\The.Matrix.1999.1080p.BrRip.x264.YIFY.d ut.mp4" -f null /dev/null
ffmpeg version N-92938-g0aaaca25e0-ffmpeg-windows-pacman Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.0 (GCC)
configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-pacman --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/opt/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libaom --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-nvenc --enable-nvdec --extra-libs=-lm --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-gpl --enable-avisynth --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxavs --enable-avresample --extra-cflags='-march=core2' --extra-cflags=-O2 --enable-static --disable-shared --prefix=/opt/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-decklink --enable-libfdk-aac
libavutil 56. 25.100 / 56. 25.100
libavcodec 58. 43.100 / 58. 43.100
libavformat 58. 25.100 / 58. 25.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 47.100 / 7. 47.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\movies\The.Matrix.1999.1080p.BrRip.x264.YIFY.d ut.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Duration: 02:16:17.91, start: 0.000000, bitrate: 2497 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800 [SAR 1:1 DAR 12:5], 2397 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 93 kb/s (default)
Metadata:
handler_name : GPAC ISO Audio Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to '/dev/null':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.43.100 wrapped_avframe
Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
Metadata:
handler_name : GPAC ISO Audio Handler
encoder : Lavc58.43.100 pcm_s16le
HERE!!! ->
frame=196071 fps=331 q=-0.0 Lsize=N/A time=02:16:17.90 bitrate=N/A speed=13.8x
video:102631kB audio:1408772kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
shareeditdeleteflag
https://www.facebook.com/Pacman-Graphics-1601114056700700/
https://www.facebook.com/gerard.wensink
gerardwensink@gmail.com
https://www.youtube.com/watch?v=W7_udMM_yHU&list=PLkcSmJZ4L--v6Lz6TfVITbj09mQS5a8FP
Similar Threads
-
AviSynth - Loop is Throwing Off Frame Count
By lomaidala in forum EditingReplies: 7Last Post: 17th Oct 2015, 12:47 -
get frame rate with FFPROBE (pls help the ***!!!!)
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 30th Aug 2014, 02:30 -
batch file ffmpeg ffprobe export media info to text file
By doomtomb in forum Newbie / General discussionsReplies: 1Last Post: 21st Jan 2014, 20:57 -
Incorrect frame-rate in FFProbe ?
By rajivrp in forum Video ConversionReplies: 0Last Post: 27th Aug 2013, 07:04 -
Frame count display in Media Player Classic? Or something else?
By Hoser Rob in forum Software PlayingReplies: 2Last Post: 10th Apr 2011, 10:59