Last active
February 18, 2020 20:29
-
-
Save Frodox/72435e3c43d2aa35cb4a to your computer and use it in GitHub Desktop.
Usefull snippets to work with video under Linux
This file contains hidden or 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
# cut video | |
## mencoder (bad way) | |
## http://www.misterhowto.com/?category=Computers&subcategory=Video&article=trim_or_split_with_mencoder | |
mencoder -endpos 00:01:32 -ovc copy -oac copy MVI_0587.MOV -o cutted2.mov | |
## ffmpeg (cut better) | |
## from 00:00 to 00:01:32 to separete file | |
ffmpeg -i MVI_0587.MOV -c:v -acodec copy -ss 00:00:00 -t 00:01:32 cutted.mov | |
# concatenate (ok) | |
# http://www.misterhowto.com/index.php?category=Computers&subcategory=Video&article=join_with_mencoder | |
mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi | |
* The -oac copy option tells mencoder to just copy the audio stream (no reencoding). -ovc copy does the same with the video stream. | |
* The -idx option asks mencoder to build the index if none was found. This makes searching inside the video easier. | |
-o stands for "output" and specifies the output file. | |
* The last few parameters are the input video files. | |
* You can join as many files as you like. This will work for videos of the same resolution, and using the same codec, but any video format that mencoder recognizes is fine. | |
# convert to other codec (ok) | |
mencoder inputfile.MOV -o out.mkv -oac mp3lame -ovc x264 | |
avconv -r 30 -i out.h264 -vcodec h264 out-avconv-h264.mp4 | |
for vi in $(ls *.MOV) ; | |
do | |
echo "$vi"; | |
mencoder -quiet "$vi" -o "${vi//MOV/mkv}" -oac mp3lame -ovc x264; | |
done | |
# convert and cut (ok) | |
mencoder MVI_0587.MOV -o out.mkv -oac mp3lame -ovc x264 -endpos 00:01:32 | |
# --- | |
# video recoding from webcam | |
# get supported resolution | |
$ ffmpeg -f v4l2 -list_formats all -i /dev/video0 | |
# record with sound | |
$ arecord -l | |
# remember magic name from output | |
# https://arashafiei.wordpress.com/2012/10/12/capture-video-and-audio-from-webcam-using-ffmpeg/ | |
$ ffmpeg -f video4linux2 -r 25 -i /dev/video0 -f alsa -i plughw:U0x46d0x824,0 -ar 22050 -ab 128k -b:v 600K -strict experimental -acodec aac -vcodec mpeg4 -y webcam.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment