I have a system setup to record videos from multipul ip cameras into mp4 files at the end of everyday a new folder is created and the next days worth of cam footage is saved in here and so on day after day.
I am trying to convert each of these mp4 files into segmented hls streams i can convert a single file with no problems using the following code
ffmpeg -i cam10029.mp4 -threads 0 -vf scale=1280:-2:force_original_aspect_ratio=decrease -c:a aac -ar 48000 -b:a 128k -c:v h264 -profile:v main -crf 20 -g 48 -keyint_min 48 -sc_threshold 0 -b:v 1500k -maxrate 2675k -bufsize 3750k -hls_time 6 -hls_playlist_type vod -hls_segment_filename index_%03d.ts index.m3u8
but each folder can have sometimes 100-200 videos in it and doing this one by one takes for ever changing the name and rerunning the command and having to check when done
i tried using something like this
for i in *.mp4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" "${name}.mov"
done
sadly this did not work on windows in a batch file it just flickered on screen then gone.
I am now using ubuntu 18 and wondering if there is a way todo it better on here ?
what i would like to do is run say one convert.sh file and have it find all the videos in the folder then create a new folder for the first video with the same name as the video then convert it into segmented stream and save the .ts and .m3u8 files in this folder delete the origenal video file then move onto the next file and do the same until all the files are converted in the folder so i can then link to the m3u8 files for each camera via my android app