Skip to content

Instantly share code, notes, and snippets.

@juliojsb
Last active April 10, 2016 17:44
Show Gist options
  • Save juliojsb/2ef8b3ae566a6ad72f95c2005e875233 to your computer and use it in GitHub Desktop.
Save juliojsb/2ef8b3ae566a6ad72f95c2005e875233 to your computer and use it in GitHub Desktop.
Some examples and tips to convert formats and record audio/video using avconv tool
# ---Format conversions
# Extract audio from video file
avconv -i video.mp4 -vn -f mp3 audio.mp3
# Extract just video without audio
avconv -i video.mp4 -vcodec libx264 -an -f mp4 just_video.mp4
# Convert MP3 to WAV
avconv -i audio.mp3 audio.wav
# Convert AVI to MKV
avconv -i video.avi -vcodec libx264 video.mkv
# Convert MOV to MP4
avconv -i video.mov -c:v libx264 video.mp4
# Convert MP4 to AVI
avconv -i video.mp4 -vcodec libx264 video.avi
# ---Screencasting/recording
Note that the input -i option varies depending on your system specifications.
Use pactl list sources and look for the "Name" string to look for the operative audio device in your computer
# Record desktop video/audio
avconv -f pulse \
-i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor \
-f x11grab \
-r 30 \
-s 1920x1080 \
-i :0.0 \
-vcodec libx264 \
-preset ultrafast \
-threads 4 \
-strict experimental \
-y myscreencast.mp4
# Record just audio
avconv -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor audio.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment