8000 draft of embedding timecode in post process by dericed · Pull Request #909 · amiaopensource/vrecord · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

draft of embedding timecode in post process #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
29 changes: 25 additions & 4 deletions vrecord
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -357,6 +357,24 @@ _eia608dump2scc(){
_end_scc
}

_timecodetxt2timecodexml(){
local INPUT_XML="${1}"

echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<MediaTimecode'
echo ' xmlns="https://mediaarea.net/mediatimecode"'
echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
echo ' xsi:schemaLocation="https://mediaarea.net/mediatimecode https://mediaarea.net/xsd/mediatimecode.xsd"'
echo ' version="0.0">'
echo ' <creatingLibrary version="${VERSION}" url="https://github.com/amiaopensource/vrecord">vrecord</creatingLibrary>'
echo " <media ref=\"${VIDEO_INPUT_CHOICE}\" format=\"${TIMECODE_CHOICE}\">"
echo " <timecode_stream id=/"${TIMECODE_CHOICE}/" format=/"smpte-st331/" frame_rate=/"30000/1001/" frame_count=\"$(grep -c 'timecode=' "${INPUT_XML}")\" fp=\"0\" bgf=\"0\" bg=\"0\">"
grep 'timecode=' "${INPUT_XML}" | sed 's/timecode=/ <tc v="/;s/$/\"\/>/'
echo ' </timecode_stream>'
echo ' </media>'
echo '</MediaTimecode>'
}

_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."
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down
0