Skip to content

Instantly share code, notes, and snippets.

@YukinoAi
Created February 5, 2018 02:22
Show Gist options
  • Save YukinoAi/bb053f9e4d65155d3123ead9fa03a18e to your computer and use it in GitHub Desktop.
Save YukinoAi/bb053f9e4d65155d3123ead9fa03a18e to your computer and use it in GitHub Desktop.
ffmpeg and avisynth syntax for GoP options
#To create:
ffmpeg -i myvideo.avs -vf "fps=24000/1001" out\image-%06d.png
ffmpeg -i "myvideo.avs" -vf "fps=24000/1001" -pix_fmt rgb24 "out\video-%06d.png"
ffmpeg -i input.avi -vf "fps=24000/1001" -pix_fmt rgba out\image-%06d.tiff
ffmpeg -i input.avi -vf "fps=24000/1001" -pix_fmt rgb24 -compression_algo raw out\image-%06d.tiff
-pix_fmt rgb24, rgba, yuv420p, yuv422p, yuv444p
-output: png, jpg, bmp, tif, tiff
Encoding (lossless) from series of pictures:
ffmpeg -framerate 24000/1001 -i "out\image-%06d.png" -c:v huffyuv out.avi
Use "-pix_fmt yuv422p" in the ffmpeg command to make the output smaller with huffman
#start AVISynth section#
#ImageReader() example
images="relative\path\video.%06d.png"
ImageReader(images,fps=23.976,start=1,end=2877) #be sure to specify last frame
#ImageReader(images,fps=23.976,start=12,end=2170)
#ImageReader(images,fps=23.976,start=313,end=321)
#ImageReader(images,fps=23.976,start=313,end=321,pixel_type="RGB32") #specifies output type
#ImageReader(images,fps=23.976,start=313,end=321,pixel_type="RGB24")
#ImageReader(images,fps=23.976,start=313,end=321,pixel_type="Y8") #Y8 is grayscale (no U V channels)
#ConvertToYV12(matrix="Rec601") #always specify a matrix, use unmodified input to check for distortions from ImageReader() or ConvertToYV12()
#ConvertToYV12(matrix="PC.601")
ConvertToYV12(matrix="Rec709")
#ConvertToYV12(matrix="PC.709")
__END__
#Corona library example from http://avisynth.nl/index.php/ImageSequence
images="R:\must\be\absolute\path\images_%06d.png"
CoronaSequence(images,start=313,stop=321) #always outputs rgb32 and 25fps
#fix fps
#AssumeFPS("pal_film") #25.0, (default)
#AssumeFPS("ntsc_film") #23.976
#AssumeFPS("ntsc_video") #29.970
AssumeFPS(24000,1001)
#AssumeFPS(30000,1000)
#convert to YV12
ConvertToYV12(matrix="Rec709")
#end AVISynth section#
How to Install HuffYUV VFW codec (for use in AVISynth) on Windows 64-bit:
Download 32-bit huffyuv codec: http://www.videohelp.com/software/HuffYUV
extract contents to c:\huffyuv and C:\windows\syswow64
cmd
cd C:\windows\syswow64
rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 0 huffyuv.inf
navigate to c:\huffyuv
Try playing .avs file again: AviSource(out.avi) should work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment