Skip to content

Instantly share code, notes, and snippets.

@jaimemrjm
Last active November 30, 2023 19:04
Show Gist options
  • Save jaimemrjm/7ab3b2c0923e3c8efbc199e7747485a7 to your computer and use it in GitHub Desktop.
Save jaimemrjm/7ab3b2c0923e3c8efbc199e7747485a7 to your computer and use it in GitHub Desktop.
Multimedia tips for Linux about format conversions, removing noise, etc.

Video tips for Linux

Convert any video file to HEVC

Convert any video file to HEVC (H.265) keeping audio tracks:

ffmpeg -i <input_file> -c:v libx265 -x265-params crf=23 -c:a copy <output_file>

Convert ASS / SSA subtitles to SRT in batch

To avoid server transcoding or playing issues in limited devices:

for i in *.mkv; do ffmpeg -i "$i" -map 0:v -map 0:a -map 0:s -c copy -c:s srt "${i%.*}-new.mkv"; done

Convert audio format in a Matroska video (.mkv file) to get wider compatibility:

ffmpeg -i input_file.mkv -c:v copy -c:a libmp3lame -b:a 128k output_file.mkv 

Extract audio from Youtube video

 youtube-dl --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 "http://youtube.com/the_video"

Remember to keep youtube-dl updated from pip.

Audio tips for Linux

Remove noise or echo in the microphone input

Edit the /etc/pulse/default.pa file as root and comment out or add this line:

load-module module-echo-cancel

Source: [1]: https://askubuntu.com/questions/18958/realtime-noise-removal-with-pulseaudio

Photo and image editing

Resize images automatically

find . -iname "*.jpg" | xargs -l -i convert -resize 50% -quality 80 {} /tmp/xxxxx/{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment