Saturday, August 27, 2022

ffmpeg - fast audio video edit

 Cut video segment

 Download the ffmpeg.exe and run it from cmd. https://ffmpeg.org/

ffmpeg.exe -ss 00:12:58 -t 00:04:29 -i video.mp4 -acodec copy -vcodec copy segment.mp4

-ss -> set first time interval
-t -> how much to cut in hours minutes seconds
* note this is not the second time position in the original video but it is t2-t1 - where t1 is the time mentioned with -ss
-i -> the input video

For exemaple original video has 20 minutes and we want to cut a segment from time 00:12:58 to time 00:17:39. si 17:39-12:58 = 04:29 -> 4 minutes and 29 seconds.

 next two to copy both video and sound 
and last argument segment.mp4 the name of the output video.

Cut a song from a video and then convert to mp3. 

ffmpeg -i song2.mp4 -vn song2.mp3

-vn option explicitly drops video so the conversion is much much faster.

Repeat song / video

ffmpeg -stream_loop 3 -i input.mp4 -c copy output.mp4

Extract audio mp3

ffmpeg -i input.mp4 out.mp3

ffmpeg -i input.mp4 -vn -acodec copy out.aac/mp3 - check with mediainfo

ffmpeg -i out.aac out.mp3


Sample rate = 1 sec = 44.000 samples

44khz -> 2 chanells of 22 khz each 

human hearing 20hz - 20khz

CD 44khz. DVD 48khz HD 96khz

Subtitles

ffmpeg -i "in.mp4" -lavfi "subtitles=sub.srt:force_style='Alignment=2,OutlineColour=&H100000000,Outline=1,Shadow=0,Fontsize=18,MarginV=70'" "output.mp4"


Saturday, August 13, 2022

Heatbed MOSFET 3d printer

  HA210N06 -  210A 60V N-Channel MOSFET - datasheet

MB6S - Bridge Rectifier - it corrects reverse polarity to MOSFET gate - so you don't burn it. With this on the board you can connect the wire without worrying about polarity. - datasheet

EL 817 C915 - PHOTOCOUPLER - datasheet

The way it should be used it is like this:

MOSFET 25A

Voltage limits of the circuit

On the drive signal - the limiting factor is the optocoupler max forward current of 60ma. We have a 10k resistor so a maximum of 600v - that also coresponds to the bridge rectifier max voltage. So we have no maximum real limit but we have a problem with the minimum voltage.

The optocoupler support maximum 35v on the output side collector-emitter. The MOSFET takes 25v on the gate-source side, and it has a voltage divider of 50% so it takes a max of 50v DC IN but we have the 35v limit on the optocoupler. So 35v is maximum DC IN.

optocoupler input is connected through a 103 resistor - 10k - after it passes through the bridge rectifier first. If you are using a microcontroller with 3.3v logic voltage it will not open. You need to replace the 10k with 1k 102 resistor.