Monday, April 5, 2021

Combine image + audio file to make a video

Source: https://video.stackexchange.com/questions/5291/how-to-make-a-video-from-a-still-image-and-an-audio-file

I tried at least 5 commands from different sites, and only this one worked well enough for me - about 37x speed, waitable.

ffmpeg -loop 1 -f image2 -r 2 -i image.jpg -i audio.m4a -c:v libx264 -c:a copy -shortest video.mp4

Wednesday, February 3, 2021

How to prevent Automounting of Volumes (USB drives, optical discs, etc) upon connecting on Mac OS X

 https://discussions.apple.com/docs/DOC-7942

  1. diskutil info /Volumes/<volume that shouldn't be mounted>
  2. Get UUID from output from above step 1.
  3. sudo /etc/vifs
  4. Add this to the file:
    1. UUID=<LONG-UUID-LIKE-F77F-3F72-A6C2-26676F39B7CE> none hfs rw,noauto
  5. sudo automount -vc
Done! Worked for me!

Saturday, December 26, 2020

ffmpeg aac -> mp3 conversion

It seems that it isn't easy to handle aac/m4a files in sox anymore. Online help threads suggest using ffmpeg to convert it to mp3 instead:

 ffmpeg -i input.m4a -c:a libmp3lame -q:a 8 output.mp3

Reference link: https://askubuntu.com/questions/1200430/how-to-convert-m4a-audio-files-to-mp3-use-command-line

Wednesday, January 9, 2019

watch

Have you ever wanted to run some command periodically, usually to wait for some change in the result (like waiting for some ACL to be propagated, a price value to change, etc)?

Seek no more! Do you know the "watch" unix command?
watch -n 60 <command>
This will run <command> every 60 seconds! And you can inspect the output every time it does.

Its usage is quite simple. The help output is:

Usage:
 watch [options] command

Options:
  -b, --beep             beep if command has a non-zero exit
  -c, --color            interpret ANSI color and style sequences
  -d, --differences[=<permanent>]
                         highlight changes between updates
  -e, --errexit          exit if command has a non-zero exit
  -g, --chgexit          exit when output from command changes
  -n, --interval <secs>  seconds to wait between updates
  -p, --precise          attempt run command in precise intervals
  -t, --no-title         turn off header
  -x, --exec             pass command to exec instead of "sh -c"

 -h, --help     display this help and exit
 -v, --version  output version information and exit

Useful command to know!

Saturday, December 22, 2018

Noise removal (sox) and fixing video/audio merge (ffmpeg)

When you have some audio and it's noisy, remove the noise with this:

# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof

# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
Referral:
https://unix.stackexchange.com/questions/425853/how-to-clear-background-noises-with-sox

_____________________________________________________________________________
When you're merging audio and video with ffmpeg, and your video ends up silent, remember to map the video and audio streams from the two files explicitly:
ffmpeg -y -i merged.mp4 -i combined.mp3 -c:a aac -map 0:v -map 1:a output.mp4
Referral:
https://unix.stackexchange.com/questions/425853/how-to-clear-background-noises-with-sox

Tuesday, October 2, 2018