-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AnalystAnimations
Varying time:
#!/bin/bash
DATE="2012-11-10"
# Brooklyn
#BBOX="-74.02587890625,40.650038657421916,-73.751220703125,40.769491796481404"
# Regional
BBOX="-74.26277,40.47254,-73.16413,40.97471"
# OpenPlans
ORIGIN="40.719518,-73.9997"
i=0
for h in {0..12}; do
for m in {0..59}; do
for s in {0..59..20}; do
TIME=`printf "%02d:%02d:%02d" ${h} ${m} ${s}`
URL="http://localhost:8080/opentripplanner-api-webapp/ws/wms?layers=traveltime&styles=color30&batch=true&mode=TRANSIT%2CWALK&maxWalkDistance=4000&date=${DATE}&time=${TIME}&fromPlace=${ORIGIN}&toPlace=${ORIGIN}&format=image/geotiff&srs=EPSG:3857&width=1280&height=720&bbox=${BBOX}×tamp=true"
echo $URL
wget $URL -O "$i.tif"
i=$((i+1))
done; done; doneVarying position (floating point math is not straightforward in shell scripts, but you can use the 'bc' calculator language):
#!/bin/bash
LAT0="40.685"
LON0="-73.95"
STEP="-0.0001"
TIME="08:00:00"
DATE="2012-11-10"
WIDTH=1280
HEIGHT=720
# regional
BBOX="-74.26277160644531,40.47254674190491,-73.16413879394531,40.974714106324654"
# alternate loop option:
# for i in $(seq 1 0.05 3); do
LON=$LON0
for c in {0..1000}; do
LAT=`bc <<< $LAT0+$STEP*$c`
URL="http://localhost:8080/opentripplanner-api-webapp/ws/wms?layers=traveltime&styles=color30&batch=true&mode=TRANSIT%2CWALK&maxWalkDistance=10000&date=${DATE}&time=${TIME}&fromPlace=${LAT},${LON}&toPlace=${LAT},${LON}&format=image/geotiff&srs=EPSG:3857&width=${WIDTH}&height=${HEIGHT}&bbox=${BBOX}×tamp=true&maxTransfers=3"
echo $URL
wget $URL -O "$c.tif"
doneAt least in the Ubuntu package, h.264 encoding support is not built in to avconv or ffmpeg. You can install the x264 package which has command line utilities to handle encoding images to video with h.264.
The YUV colorspace called i420 has separate luminance for each pixel, but only one blue and red value for each block of 4 pixels. This is the native representation for h264 encoding. Therefore the input images' width and height must be multiples of 2. x264 will not do autocropping on principle. Fortunately x264 has crop / resize filters built in.
Example command line:
x264 "./%d.tif" --crf 25 --vf crop:129,100,120,103 -o test.mp4
crop values are left,top,right,bottom
(these were chosen to get 1280x720 720p video)
The -crf switch controls the quality. Smaller numbers mean larger file sizes.
You can specify the output color space with --output-csp rgb but this makes the file much bigger and VLC can't seem to play it.
unless you are intentionally working with legacy versions of OpenTripPlanner. Please consult the current documentation at readthedocs