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
import sys | |
import re | |
from BeautifulSoup import BeautifulSoup | |
def processFile(filename): | |
print "reading and writing from: " + str(filename) | |
file = open(filename, "r+") | |
#lines = file.readlines() |
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
with open("myFile.txt") as f: | |
for line in f: | |
print line |
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
import scipy.io | |
import numpy as np | |
from PIL import Image | |
np.set_printoptions(threshold=np.nan) | |
mat = scipy.io.loadmat('train_32x32.mat') | |
arr = np.array(mat["X"]) | |
for i in range(5000): |
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
ffmpeg -f image2 -framerate 15 -i %05d.jpg -c:v libx264 -pix_fmt yuv420p -r 15 128Mov2.mp4 | |
# -r forces framerate | |
# -f image2 tells ffmpeg its an image sequence |
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
for i in {1..60}; do printf "file '%s'\n" 128Mov2.mp4 >>list.txt; done | |
ffmpeg -f concat -i list.txt -c copy output.mp4 |
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
ffmpeg -i 128Mov2Cat.mp4 -vf pad=1280:800:576:336 128Mov2CatBars.mp4 | |
#default pad is black | |
#pad=width:height:x:y |
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
ffmpeg -i in.%%04d.tif -compression_algo lzw out.%%04d.tif |
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
mogrify -path outFolder -depth 16 -endian msb -compress lzw rawImages/*.tif | |
#outFolder is a newFolder where images will be saved | |
#rawImages is a folder where the images to be compressed are stored. |
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
#I think it might be possible to do this all in a single shell by using single ampersand (&) at end of each command | |
#make two pipes | |
mkfifo /tmp/pipe1 /tmp/pipe2 | |
#send input1 to pipe1 | |
ffmpeg -y -i input1.mp4 -c copy -f nut /tmp/pipe1 | |
#open a new shell window/tab | |
#send input2 to pipe2 |
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
ffmpeg -i input.mov -c:v libx264 -maxrate 20000k -bufsize 3000k -pix_fmt yuv420p -crf 24 out.mp4 | |
# see here https://trac.ffmpeg.org/wiki/Encode/H.264 | |
# -pix_fmt may not be necessary but I use it sometimes for backwards compatibility. | |
# -bufsize tells ffmpeg how often to check that bitrate is at the requested rate | |
# -crf is not necessary but can get videos really small if set >30 (at the expense of quality) |
OlderNewer