====== Extract embedded 608 closed captions to subtitle file ======
Some MP4 and ts files have closed captions embedded in the old ATSC standard. Some players can't handle embedded closed captions, and it's more convenient to have it as a separate file.
You can extract the CC streams and save it as a separate file as follows:
ffmpeg -f lavfi -i "movie='input'[out0+subcc]" -map s "output.ssa";
where input and output are the filenames to use. Subrip SRT files can be used for the output instead of SubStationAlpha SSA files. SSA seems to actually decode the proper colours and location of the closed captions better, and maintains that information although it is less compatible with some players.
You can easily make this loop across a folder with a for loop.
for i in *.mp4;
do name=`echo $i | cut -d'.' -f1`;
ffmpeg -f lavfi -i "movie='$i'[out0+subcc]" -map s "${name}.ssa";
done