Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Resources/vrecord_functions
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ _update_config_file(){
echo "DV_RESCUE_OPTION_TC=\"${DV_RESCUE_OPTION_TC}\""
echo "CC2VTT=\"${CC2VTT}\""
echo "CC2SRT=\"${CC2SRT}\""
echo "CAP2MP4=\"${CAP2MP4}\""
echo "MEDIA_ID_TYPE=\"${MEDIA_ID_TYPE}\""
echo "WEBVTT_EXTRA=\"${WEBVTT_EXTRA}\""
echo "HD_CHOICE=\"${HD_CHOICE}\""
Expand Down
24 changes: 22 additions & 2 deletions vrecord
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,11 @@ OPTIONAL_TOOLS_GUI=$(cat << CONFIG_FORM
<default>"${CC2SRT}"</default>
<variable>CC2SRT</variable>
</checkbox>
<checkbox>
<label>Wrap captions into Access MP4 file</label>
<default>"${CAP2MP4}"</default>
<variable>CAP2MP4</variable>
</checkbox>
</vbox>
</frame>
<frame FADGI WebVTT header>
Expand Down Expand Up @@ -3181,11 +3186,26 @@ if [[ "${DEVICE_INPUT_CHOICE}" = 0 ]] ; then
_mv_tmp_file "${CAPTION_TMP}" "${CAPTION_LOG}"
_eia608dump2scc "${CAPTION_LOG}" "${CAPTION_SCC}"
if [[ "${CC2VTT}" = 'true' ]] ; then
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${CAPTION_SCC}" "${CAPTION_SCC%.*}.vtt"
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${CAPTION_SCC}" -f webvtt - | sed -E 's/\\h//g; s/\{\\an[0-9]\}//g; s/<[^>]+>//g' > "${CAPTION_SCC%.*}.vtt"
_add_fadgi_header2vtt "${CAPTION_SCC%.*}.vtt"
fi
if [[ "${CC2SRT}" = 'true' ]] ; then
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${CAPTION_SCC}" "${CAPTION_SCC%.*}.srt"
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${CAPTION_SCC}" -f srt -c:s srt - | sed -E 's/\\h//g; s/\{\\an[0-9]\}//g; s/<[^>]+>//g' "${CAPTION_SCC%.*}.srt"
fi
if [[ "${CAP2MP4}" = 'true' && "${MP4_CHOICE}" = 'true' ]] ; then
if [[ -s "${CAPTION_SCC%.*}.vtt" ]] ; then
CAP2EMBED="${CAPTION_SCC%.*}.vtt"
elif [[ -s "${CAPTION_SCC%.*}.srt" ]] ; then
CAP2EMBED="${CAPTION_SCC%.*}.srt"
else
CAP2EMBED="$(_maketemp .vtt)"
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${CAPTION_SCC}" -f webvtt - | sed -E 's/\\h//g; s/\{\\an[0-9]\}//g; s/<[^>]+>//g' > "${CAP2EMBED}"
fi
_report -dt "Wrapping the extracted captions into the Access MP4 file..."
"${FFMPEG_BIN}" -nostdin -v 0 -y -i "${MP4NAME}" -i "${CAP2EMBED}" -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s mov_text "${MP4NAME}.subs.mp4"
if [[ $? -eq 0 ]]; then
mv -v "${MP4NAME}.subs.mp4" "${MP4NAME}"
fi
fi
fi

Expand Down