Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
software:video [2010/03/12 23:51] cyril |
software:video [2024/05/12 22:48] (current) cyril [ffmpeg] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Multimedia encoding ====== | ====== Multimedia encoding ====== | ||
| - | ===== Windows ===== | ||
| - | VirtualDub | + | ===== Images ===== |
| - | ===== Linux ===== | + | ==== convert |
| + | === size operations | ||
| - | ==== Images ==== | + | |
| - | + | ||
| - | === convert === | + | |
| - | == size operations == | + | |
| - | + | ||
| - | | + | |
| - | < | + | |
| convert in.png -resize 640x480 out.png | convert in.png -resize 640x480 out.png | ||
| </ | </ | ||
| - | * crop: crop image | + | * crop: crop image< |
| - | < | + | |
| convert in.png -crop 640x480+10+10 out.png | convert in.png -crop 640x480+10+10 out.png | ||
| </ | </ | ||
| - | * extent: add margins or crops | + | * extent: add margins or crops< |
| - | < | + | |
| convert in.png -gravity center -extent 1420x1420 | convert in.png -gravity center -extent 1420x1420 | ||
| convert in.png | convert in.png | ||
| </ | </ | ||
| + | === Annotate an image with text === | ||
| + | Simple text: | ||
| + | < | ||
| + | convert in.png \ | ||
| + | -pointsize 20 -fill red -draw 'text 10,30 "My text" ' \ | ||
| + | out.png | ||
| + | </ | ||
| - | + | Text with shadow: | |
| - | == Annotate an image with text== | + | |
| < | < | ||
| convert in.png \ | convert in.png \ | ||
| -gravity SouthEast \ | -gravity SouthEast \ | ||
| - | -stroke '# | + | -stroke '# |
| - | -stroke none | + | -stroke none -fill white -annotate 0 "My text" |
| out.png | out.png | ||
| </ | </ | ||
| - | == Append images == | + | === Append images |
| < | < | ||
| Line 43: | Line 41: | ||
| </ | </ | ||
| - | ==== Video ==== | + | More complex: |
| - | === mencoder === | + | < |
| + | convert im1.png -resize 640x480 ppm:- \ | ||
| + | | convert im2.png - +append ppm:- \ | ||
| + | | convert im3.png - -append final.png | ||
| + | </ | ||
| + | |||
| + | === Create animated GIF === | ||
| + | |||
| + | < | ||
| + | |||
| + | === Formats === | ||
| + | * EPS to RGB:< | ||
| + | convert -density 600x600 -flatten -depth 8 -colorspace RGB file.eps ppm:- | convert - file.png | ||
| + | </ | ||
| + | |||
| + | ==== Exif ==== | ||
| + | === exiftool === | ||
| + | * restore exif Orientation tag: if you have photos captured with a device that sets the orientation tag, but you used a viewer that doesn' | ||
| + | exiftool -overwrite_original -Orientation=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Video ===== | ||
| + | ==== mencoder | ||
| (comes with mplayer). | (comes with mplayer). | ||
| [[http:// | [[http:// | ||
| - | == From another video file == | + | General syntax: |
| - | + | ||
| - | Example with xvid codec : | + | |
| <code bash> | <code bash> | ||
| mencoder \ | mencoder \ | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| </ | </ | ||
| + | === Input data and options === | ||
| + | * Video files< | ||
| + | mencoder \ | ||
| + | < | ||
| + | <input options> \ | ||
| + | <output options> \ | ||
| + | <output data> | ||
| + | </ | ||
| - | Options : | + | |
| - | | + | mencoder \ |
| - | * trellis : speeds up encoding | + | |
| - | * oac = audio codec | + | |
| - | | + | < |
| - | * pp = post processing subfilters | + | < |
| - | * yadif : deinterlace | + | </ |
| - | == From multiple | + | * Image files from stdin (only works with jpg images, but you can use convert to pipe to mencoder)< |
| + | mencoder \ | ||
| + | - \ | ||
| + | -demuxer lavf -lavfdopts format=mjpeg \ | ||
| + | <output options> \ | ||
| + | <output data> | ||
| + | </ | ||
| - | < | + | * Video filters: |
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | === Output data and options === | ||
| + | |||
| + | Specify the video codec with '' | ||
| + | |||
| + | * **xvid** < | ||
| + | mencoder \ | ||
| + | <input data> \ | ||
| + | <input options> \ | ||
| + | -ovc xvid -xvidencopts bitrate=800: | ||
| + | -o < | ||
| + | </ | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | * **h264** | ||
| mencoder \ | mencoder \ | ||
| + | <input data> \ | ||
| + | <input options> \ | ||
| -ovc x264 -x264encopts bitrate=800 \ | -ovc x264 -x264encopts bitrate=800 \ | ||
| - | -vf scale=640:480 \ | + | -o < |
| - | | + | </ |
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | * **WebM** < | ||
| + | mencoder | ||
| + | | ||
| + | <input options> \ | ||
| + | -ovc lavc -ffourcc VP80 -of lavf -lavfopts format=webm -lavcopts vcodec=libvpx:vqscale=22.0 \ | ||
| + | -o < | ||
| + | </ | ||
| + | | ||
| + | * '' | ||
| + | |||
| + | * **mp3** < | ||
| + | mencoder \ | ||
| + | <input data> \ | ||
| + | <input options> \ | ||
| + | -oac mp3lame -lameopts abr:br=128 \ | ||
| + | | ||
| </ | </ | ||
| - | === AviDemux === | + | === Other operations === |
| + | |||
| + | * cut the file (here from 10' | ||
| + | mencoder -ss 10:00 -endpos 30 -ovc copy -oac copy movie.avi -o submovie.avi | ||
| + | </ | ||
| + | |||
| + | ==== ffmpeg ==== | ||
| + | |||
| + | * video codec: '' | ||
| + | * audio codec: '' | ||
| + | * codec bitrate: video '' | ||
| + | * codec quality: video '' | ||
| + | |||
| + | * crop: '' | ||
| + | * resize: '' | ||
| + | * pad: '' | ||
| + | * rotate: '' | ||
| + | |||
| + | * blur: '' | ||
| + | * overlay two videos:< | ||
| + | ffmpeg -i in1.avi -vf " | ||
| + | </ | ||
| + | ffmpeg -i in1.avi -i in2.avi -filter_complex " | ||
| + | </ | ||
| + | |||
| + | * append side by side two videos:< | ||
| + | ffmpeg -i in_left.avi -vf " | ||
| + | </ | ||
| + | |||
| + | * encode video from images sequence (eg for timelapse):< | ||
| + | ffmpeg -r 50 -i 01/ | ||
| + | ffmpeg -r 10 -pattern_type glob -i " | ||
| + | </ | ||
| + | |||
| + | * cut clip (ss is start time, t is duration):< | ||
| + | ffmpeg -i in.avi -ss 00:00:23 -t 00:00:19 -vcodec copy -acodec copy out.avi | ||
| + | </ | ||
| + | |||
| + | * render subtitles (requires to be compiled with libass): '' | ||
| + | |||
| + | * transform portrait video 640x480 to landscape 1280x720 with blurry repeated sides:< | ||
| + | ffmpeg -i in.avi -filter_complex "[0:v] transpose=2, | ||
| + | ' | ||
| + | </ | ||
| + | ==== AviDemux | ||
| A GUI easier to use, like VirtualDub for Windows. | A GUI easier to use, like VirtualDub for Windows. | ||
| - | ==== Audio ==== | ||
| - | === mp3 === | + | ==== PhotoFilmStrip ==== |
| + | |||
| + | |||
| + | |||
| + | ==== Kdenlive ==== | ||
| + | |||
| + | Tried Openshot and Cinelerra but seem crappy, Kdenlive seems to have better design. | ||
| + | |||
| + | * Transitions : works between two video tracks that overlap (eg dissolve). | ||
| + | * Audio track volume : add effect "Audio Correction / Volume (keyframable)", | ||
| + | ===== Audio ===== | ||
| + | |||
| + | ==== mp3 ==== | ||
| => '' | => '' | ||
| Line 93: | Line 224: | ||
| </ | </ | ||
| - | === ogg === | + | => '' |
| + | |||
| + | To cut an mp3 file (warning: ID3 tags are not copied): | ||
| + | <code bash> | ||
| + | mp3cut -o output.mp3 -t 00: | ||
| + | </ | ||
| + | |||
| + | To concatenate mp3 files: | ||
| + | <code bash> | ||
| + | mp3cut -o output.mp3 input1.mp3 input2.mp3 input3.mp3 | ||
| + | </ | ||
| + | |||
| + | => '' | ||
| + | |||
| + | To copy ID3 tags from a file to another one. | ||
| + | |||
| + | => '' | ||
| + | |||
| + | To view and edit ID3 tags in command line. | ||
| + | |||
| + | => '' | ||
| + | |||
| + | To view and edit ID3 tags in GUI. | ||
| + | |||
| + | |||
| + | ==== ogg ==== | ||
| (using vorbis-tools package) | (using vorbis-tools package) | ||
| Line 100: | Line 256: | ||
| To encode from wav to ogg in " | To encode from wav to ogg in " | ||
| <code bash> | <code bash> | ||
| - | oggenc -b 32 --downmix --resample 22050 file.wav file.ogg | + | oggenc -b 32 --downmix --resample 22050 file.wav |
| </ | </ | ||
| Line 106: | Line 262: | ||
| <code bash> | <code bash> | ||
| oggdec -b 16 -R file.ogg -o - | oggenc -r -B 16 -C 1 -b 32 --resample 22050 - -o file_recomp.ogg | oggdec -b 16 -R file.ogg -o - | oggenc -r -B 16 -C 1 -b 32 --resample 22050 - -o file_recomp.ogg | ||
| + | </ | ||
| + | |||
| + | ==== sox ==== | ||
| + | play, record, process | ||
| + | |||
| + | * Cut: (start position / length)< | ||
| + | sox in_file.wav out_file.wav trim 2:37:32 4:00 | ||
| + | </ | ||
| + | * Reencode:< | ||
| + | sox in_file.type1 out_file.type2 | ||
| + | sox in_file.type1 -t type2 - | oggenc ... | ||
| + | </ | ||
| + | |||
| + | ==== ffmpeg ==== | ||
| + | |||
| + | * extract sound track from video: < | ||
| + | ffmpeg -i video.avi sound.mp3 | ||
| </ | </ | ||
