Today, on the way home from Kaukapakapa today, I stopped by the cemetary to photograph the flower shoots on the flax bushes there. While I was taking the photographs a Tui came to feed on the flowers and I captured the action in a video,
VID_20181123_112638308.mp4.
I then processed the video, which was too far away from the focus of interest, using ffprobe, GIMP, and ffmpeg.
1) ffprobe showed that the original video was framed at 1280x720.
ffprobe VID_20181123_112638308.mp4
2) Using ffmpeg I copied the video eliminating the sound track, reducing the file size from 18M to 17M
ffmpeg -i VID_20181123_112638308.mp4 -c copy -an TuiFeeding.mp4
3) Using ffmpeg I extracted one frame from the video with which to work out the cropping parameters.
ffmpeg -ss 00:00:10 -i VID_20181123_112638308.mp4 -vf scale=720:-1 -vframes 1 TuiFeeding.jpg #image extracted at 10 second mark.
4) Using GIMP and the single frame extracted above I worked out that I needed a frame of
output scaled to 436x648 starting at 188x256 from original scale 720x1280
5) Using ffmpeg to crop and scale with imput of the original video and output to new file.
ffmpeg -i TuiFeeding.mp4 -filter:v "crop=436:648:188:256" -c:a copy TuiFeeding-2018-10-23.mp4
Note (1): I could have eliminated a step at 2) by using -c:an here.
Note (2): Final file size reduction is from 18,408,197 to 1,974,178 or 9.32:1, or 89.3% reduction
6) I then ran a script to set all the files timestamps equal to a reference file so that they would be correctly timestamped for reporting on iNaturalist
#!/bin/bash
# Set-mp4-timestamp-to-ref-file.sh
# Set the modification time of the MOV file to the reference .JPG file from the cellphone camera
#for i in *.jpg ; do
for i in *.mp4 ; do
touch $i -r IMG_20181123_112652146.jpg
done
The original video has been uploaded to Vimeo at https://vimeo.com/302369650
The final version of the video has also been uploaded to Vimeo at https://vimeo.com/302368642
Comments (0)
You don't have permission to comment on this page.