lundi 30 septembre 2019

Run ffmpeg command based on data on a file

I have a text file that gets generated from running a command.

The text file has name of a file followed by all the matching audio tracks in one line then next line has the next video followed by matching tracks.

Because some of the videos have less tracks and some have more.is there a way i can do if and else command for ffmpeg to do the mergeing based on number of tracks matched to the name.

This is the command i use to merge. Merge (Copy Video and Audio)

ffmpeg -i video.mxf_V1.MXF.m2v -i video.mxf_A1.MXF -i video.mxf_A2.MXF -c copy out.mxf

followed by:

ffmpeg -i out.mxf -map 0:0 -map 0:1 -map 0:1 -c copy finished.mxf

Below is the example of how the file names are and how its written in the text file "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_V1.MXF.m2v" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A1.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A2.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A3.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A4.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A5.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A6.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A7.MXF" "5f367f72-9e2f-4f89-b3d6-2cdafed17d94_IRR_DOCUI_SONG_SomeMusic_KomKom.mxf_A8.MXF"

There's about 25,000 lines of these.

another thing i wanted is to be able to name the final file the same as the video file. Please.

Aucun commentaire:

Enregistrer un commentaire