2019年11月30日星期六

Possible causes of no output from SPAD sensor

As the first time I used a SPAD sensor, I didn't get the correct output from my SPAD sensor for two reasons:

Reason 1:


The enable terminal is not connected high level voltage. The SPAD sensor is likely to have an enable terminal. Only when the enable terminal is connected to a high level can data be collected normally.

Reason 2:


The protective head of the SPAD sensor has not been removed. In order to protect the sensor, SPAD sensors usually have a protective cover. Data can only be obtained if the black protective cover is removed.

Summary:


The above reasons are generally explained in the manual. Reading the manual carefully before the first use can avoid many common mistakes.

How to merge videos in batch?

What if we have hundreds of videos and want to merge them into one video in batches without too much trouble?


This can be done in two steps:
1. Create a text file videolist.txt
The contents are as follows:

Simple implementation of audio variable speed without changing pitch



Preparation: ffmpeg needs to be installed

Method: command prompt input

All we need to do is just input:

ffmpeg -n -i input.wav -filter:a "atempo=0.5" output.wav

Where input.wav and output.wav are input files and output files, respectively, and can be other file formats, such as:

ffmpeg -n -i input.m4a -filter:a "atempo=0.5" output.mp3

Among them, 0.5 represents the multiple, and changing to 2 means 2 times speed up.


It can also be processed in batches, such as (Python):

import osimport sys
m4a_path = "./m4a/"  # m4a文件所在文件夹
finish_path = "./finished/"

def run():        m4a_file = os.listdir(m4a_path)        str1 = '-filter:a \"atempo=2\"'        print('m4a')        for i, m4a in enumerate(m4a_file):             os.system("ffmpeg -n -i "+ m4a_path + m4a             + " " +str1 + " "+finish_path + m4a[0:-4] + ".mp3" )
run()


Reference:

https://stackoverflow.com/questions/45441557/how-to-change-speed-of-a-wav-file-while-retaining-the-sampling-frequency-in-pyth/45441708