Score:0

How to convert subfolder in a directory using ffmpeg in ubuntu

cn flag

I was looking for a code to convert video files in a directory where it has multiple subfolders for each video file. I want to run a batch code so it can convert the video files and save them where the original file was there.

Example:

: tree movies/
movies/
├── subfolder1
│   └── movie1.mp4
├── subfolder2
│   └── movie2.mp4
└── subfolder3
    └── movie3.mp4

3 directories, 3 files

And so on.

I want the output to be the same as my main structure but in .m3u8 format.

I have used a code where it can convert each movie manually but for some reason, I can use the .m3u8 file or link only in that server I can't make it work all over the internet.

for i in *.mp4; do
   ffmpeg -i "$i" -c copy -map 0 -hls_time 3 -hls_list_size 0 -f hls "${i%.*}.hls"
done
David avatar
cn flag
What do you expect to do with the files after they are converted?
Score:0
pl flag

From Stack Exchange answer https://unix.stackexchange.com/questions/227662/how-to-rename-multiple-files-using-find

for i in $(find . -name '*.mp4'); do command_you_want_to_execute ; done

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.