Created
March 22, 2020 19:03
-
-
Save davehorner/d9b340bf97b14cb823c2e70aee881d21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb | |
pip install ffmpeg-python | |
https://github.com/quanhua92/human-pose-estimation-opencv.git | |
ffmpeg -i "in.mp4" -s 240x135 -vf fps=1 %d.jpg | |
dir -recurse -path data -include *.jpg -Name | %{echo "python openpose.py --input $_ --output output\sized\$_ --thr .1" } | |
find ".\data\" --name "data\*.jpg" --exec "python openpose.py --input {} --output output\{} --thr .1" \; | |
git clone https://github.com/pjreddie/darknet | |
cd darknet | |
make | |
# include/darknet.h:780:11: error: unknown type name 'clock_t'; did you mean 'clockid_t'? | |
https://github.com/pjreddie/darknet/issues/217 | |
make -nogpu # works; resolves clock_t issue above. | |
cd cfg; wget https://pjreddie.com/media/files/yolov2.weights | |
module 'tensorflow' has no attribute 'InteractiveSession' | |
change sess = tf.InteractiveSession() to sess=tf.compat.v1.InteractiveSession() | |
---- | |
Came across this question, so here's a quick comparison. Compare these two different ways to extract one frame per minute from a video 38m07s long: | |
time ffmpeg -i input.mp4 -filter:v fps=fps=1/60 ffmpeg_%0d.bmp | |
1m36.029s | |
This takes long because ffmpeg parses the entire video file to get the desired frames. | |
time for i in {0..39} ; do ffmpeg -accurate_seek -ss `echo $i*60.0 | bc` -i input.mp4 -frames:v 1 period_down_$i.bmp ; done | |
0m4.689s | |
This is about 20 times faster. We use fast seeking to go to the desired time index and extract a frame, then call ffmpeg several times for every time index. Note that -accurate_seek is the default , and make sure you add -ss before the input video -i option. | |
Note that it's better to use -filter:v -fps=fps=... instead of -r as the latter may be inaccurate. Although the ticket is marked as fixed, I still did experience some issues, so better play it safe. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment