From 3960e12cee2f0d8f02aff0632d45a65734924cb7 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Sun, 22 Jun 2025 12:36:42 -0400 Subject: [PATCH] draft of embedding timecode in post process --- vrecord | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/vrecord b/vrecord index e659384d..079e8b1f 100755 --- a/vrecord +++ b/vrecord @@ -20,7 +20,7 @@ AVFoundation. It is an interactive script and will create 10 or 8-bit video files. Dependencies: cowsay, amiaopensource/amiaos/decklinksdk, - amiaopensource/amiaos/ffmpegdecklink, amiaopensource/amiaos/gtkdialog, and + amiaopensource/amiaos/gtkdialog, mediaarea/mediaarea/ffmpeg-ma, and xmlstarlet Optional Dependencies: deckcontrol, gnuplot, mediaconch, mkvtoolnix, mpv, qcli @@ -40,7 +40,7 @@ Usage: ${SCRIPTNAME} [ -e | -r | -p | -a | -x | -n| -v | -s | -h ] [IDENTIFIER] -x reset the configuration: this will replace the default configuration file at '${CONFIG_FILE}' with an empty one. -n reset Vrecord's stored environment variables. These include - variables such as the paths to certain dependencies such as ffmpeg-dl. + variables such as the paths to certain dependencies such as ffmpeg-ma. -v Run ffmpeg with '-loglevel debug'. Using this option creates a very large log file, so avoid using this option with 'Visual + Numerical' or any playback option that display the log as part of the view. @@ -250,7 +250,7 @@ _setup_env_variables(){ _gather_ffmpeg_vars(){ CAPTURELOGSUFFIX="_vrecord_input.log" - TIMECODELOGSUFFIX="_frame_timecodes.txt" + TIMECODELOGSUFFIX="_frame_timecodes" if [[ -d "/usr/local/opt/ffmpegdecklink" ]] ; then BREW_PREFIX="/usr/local/opt/ffmpegdecklink" elif [[ -d "/home/linuxbrew/.linuxbrew/opt/ffmpegdecklink" ]] ; then @@ -357,6 +357,24 @@ _eia608dump2scc(){ _end_scc } +_timecodetxt2timecodexml(){ + local INPUT_XML="${1}" + + echo '' + echo '' + echo ' vrecord' + echo " " + echo " /' + echo ' ' + echo ' ' + echo '' +} + _cleanup(){ _report -wt "Vrecord is being stopped at $(_get_iso8601), noting this in the capture log." _writeingestlog "exit status" "vrecord was forced to quit early at $(_get_iso8601). Some processing may be incomplete." @@ -2732,7 +2750,8 @@ else FULL_OUTPUT_ID="${PREFIX}${ID}" fi FULL_CAPTURE_LOG="${LOGDIR}/${FULL_OUTPUT_ID}${CAPTURELOGSUFFIX}" -TIMECODE_LOG="${LOGDIR}/${FULL_OUTPUT_ID}_${TC_TYPE}${TIMECODELOGSUFFIX}" +TIMECODE_LOG="${LOGDIR}/${FULL_OUTPUT_ID}_${TC_TYPE}${TIMECODELOGSUFFIX}.txt" +TIMECODE_XML="${LOGDIR}/${FULL_OUTPUT_ID}_${TC_TYPE}${TIMECODELOGSUFFIX}.xml" CAPTION_LOG="${LOGDIR}/${FULL_OUTPUT_ID}_frame_eia608data.txt" CAPTION_SCC="${LOGDIR}/${FULL_OUTPUT_ID}.scc" VRECORD_OUTPUT="${DIR}/${FULL_OUTPUT_ID}.${EXTENSION}" @@ -2923,6 +2942,8 @@ if [[ "${DEVICE_INPUT_CHOICE}" = 0 ]] ; then # timecode document handling if [[ -f "${TC_TMP}" ]] ; then mv "${TC_TMP}" "${TIMECODE_LOG}" + _timecodetxt2timecodexml "${TIMECODE_LOG}" > "${TIMECODE_XML}" + ffmpeg-ma -i "${VRECORD_OUTPUT}" -mediatimecode "${TIMECODE_XML}" -strict experimental -map 0 -c copy "${TIMECODE_XML%.*}_TC.mkv" fi # caption handling if [[ -s "${CAPTION_TMP}" ]] ; then