Audio/Video

How to use streamripper to rip & split online radios using docker-compose

I published the docker image ulikoehler/streamripper to make it trivially easy to rip & split online radios.

Use this docker-compose.yml to rip a single online radio to ./TheRadio:

version: '3.5'
services:
   theradio:
     image: ulikoehler/streamripper:latest
     volumes:
       - ./TheRadio:/app
     command: ["streamripper", "https://theradio.domain/stream.mp3", "-s", "--xs2", "-d", "."]

You can use our script from Create a systemd service for your docker-compose project in 10 seconds in order to create a script to autostart the ripper on boot:

curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin

 

Posted by Uli Köhler in Audio/Video

How to encode UHD 4K video from camera for DaVinci Resolve input using ffmpeg

I use this command to convert the video from my phone (in UHD / 4K) for use as input Media in DaVinci Resolve using the DNxHR codec.

ffmpeg -i input.mp4 -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq output.mov

Note that the DNxHR files are huuuuuuge, around 10GB per minute even for some rather uncomplicated video! However, encoding is pretty fast (around 0.5x real-time on my computer) and you won’t really lose any significant amount of quality in this video type.

This shell script will batch-encode all .mp4 files in the current folder to DNxHR

for i in *.mp4 ; do ffmpeg -i $i -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq ${i}.mov ; done

 

Posted by Uli Köhler in Audio/Video

How to re-encode videos as H.265 & opus using ffmpeg for archival

When you don’t want your video archive to eat up too much space, I recommend encoding them as H.265 and OPUS as these codecs provide excellent quality with typically less than half the bitrate of older formats.

I also tried VP9 and AV1 which should result in even lower file size at the same quality. However, these are painfully slow, running at 0.0046x speed (libaom-av1) and 0.076x speed (libvpx-vp9) compared to 1.5x speed for libx265 for a test video since these encoders seem not to be highly optimized yet.

CRF means constant rate factor, higher values mean better quality but larger file size.

My recommendation is to use CRF 30 for lower-quality videos like analog grainy-ish videos, CRF 23 where you want to preserve the utmost quality, and CRF 26 for everything else.

For non-interlaced videos

ffmpeg -i input.mpg -c:v libx265 -crf 30 -c:a libopus -b:a 56k -frame_duration 60 output.mkv

For interlaced videos

Use -vf yadif=1 as interlace filter to prevent interlacing artifacts:

ffmpeg -i input.mpg -vf yadif=1 -c:v libx265 -crf 30 -c:a libopus -b:a 56k -frame_duration 60 output.mkv

 

Posted by Uli Köhler in Audio/Video