Last active
August 7, 2023 16:52
-
-
Save lg3bass/8442225 to your computer and use it in GitHub Desktop.
FFMPEG - extract srts from all .m4v files in a directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//THE ONE-LINER-COMBO-MAGIC (updated 20230807) | |
for FILENM in *; do ffmpeg -i $FILENM -vn -an -codec:s srt ${FILENM/.m4v/}.srt; ffmpeg -i $FILENM -c copy ${FILENM/.m4v/}.mp4; done; | |
//convert all the videos to a low bandwidth version and place alongside the original video. | |
//source: https://addpipe.com/blog/flv-to-mp4/ | |
for FILENM in *; do ffmpeg -i $FILENM -crf 45 -movflags faststart -profile:v baseline -level 3.1 ${FILENM/.mp4/}_3play.mp4; done; | |
//*** make sure the original video doesn't have spaces in the file name. | |
//MACOS UNIX | |
//Extract all the .srt files | |
xxxxxxx$ for FILENM in *; do ffmpeg -i $FILENM -vn -an -codec:s srt ${FILENM/.m4v/}.srt; done; | |
//Convert the .m4v files to .mp4 files while keeping the existing audio and video codecs(h.264). | |
xxxxxxx$ for FILENM in *.m4v; do ffmpeg -i $FILENM -c copy ${FILENM/.m4v/}.mp4; done; | |
//Convert the .m4v files to .mp4 file and keep the existing codec + add faststart. | |
for FILENM in *.m4v; do ffmpeg -i $FILENM -c copy -movflags faststart ${FILENM/.m4v/}.mp4; done; | |
//EXPLANATION | |
//$FILENM -- each file in the directory | |
//${FILENM/.m4v/}.srt -- strip off the .m4v extension and add .srt. | |
//-vn -an -codec:s srt -- no video stream, no audio stream, codec stuff (see source below). | |
//SOURCE: | |
//Extracting an embedded subtitle from a video file using FFMPEG | |
//http://guns.buffout.org/blog/extracting-an-embedded-subtitle-from-a-video-file-using-ffmpeg/ (404) | |
//How to extract subtitle from video using ffmpeg? | |
https://superuser.com/questions/583393/how-to-extract-subtitle-from-video-using-ffmpeg | |
//REFERENCE: | |
//Easily renaming multiple files. | |
//http://www.debian-administration.org/articles/150 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment