Re: "Extract LTC from audio and align video" menu option missing from "Transcode/Import Video file" popup

robertlazarski <[email protected]>
Newsgroups gmane.comp.audio.ardour.user
Message-ID <CABpPLBU1cYRWewUb1SRLosjiZ64BaHPkE6iH+yhsfkwjXZNqrg@mail.gmail.com>
On Sat, Apr 21, 2018 at 8:54 PM, Chris Caudle <[email protected]> wrote:

> On Fri, April 20, 2018 11:49 am, robertlazarski wrote:
> > The phone problem with Ardour was indeed because it was a variable rate
> > issue. I was able to fix it with this command. And then Ardour was fine
> > with it.
>
> That's good to know.  Did we coincidentally find that near the same time,
> or did my noticing the original was variable frame rate prompt some
> experiments to check it out?
>

I would have never figured out the variable framerate problem without your
help - thanks again for giving me a clue.  Once the q8 worked then the
phone obviously was creating videos that had some type of problem in Ardour
and I dug more into it.

I have another problem now with this phone, I can't get the phone video wav
file sample position per LTC frame to match the q8 sample position. This is
what I think is causing a 2 second delay sync problem in a 3 minute or so
in a test video that has parts from both the q8 and the phone.

I can't seem to fix this, each LTC frame has a different size in the phone
wav file compared to the q8.wav file. Both of the original videos show
"CABAC / 1 Ref Frames" . However the phone video audio was recorded as AAC
while the q8 video audio was recorded as PCM so maybe that is the issue.

# phone video in mp4 format and AAC audio, cannot fix this with ffmpeg by
any conversion I tried
00000000   00:26:55:01 |     3118     4715  # (4715 - 3118) = 1597

# q8 mov video and PCM audio
00000000   00:26:55:01 |     3123     4724 # (4724 - 3132) = 1601

Any idea how to fix this?


> >  The Tentacle Sync LTC generator also works fine and I'm really happy
> with it.
>
> Seems like a cool little device, I was not previously familiar with it.
>

I have a second TS and Q8 arriving in a few days, I am happy enough with
the combo to sort of standardize on it.  The phone videos are a PITA as I
am finding out, to the extent I don't want to mess around with multiple
phone videos.


> > To be clear my priority is good audio and then whatever video
> > that comes with it is ok for me.
>
> That is what the 8 channel Zoom audio recorder is for, right?  I assumed
> you were using a traditional arrangement where you only needed the camera
> to record timecode, all the main audio would go to the multichannel
> recorder, so camera audio quality wasn't really a consideration.
>


I just prefer balanced connections whenever possible so I use XLR / TRS
where I can. Most of what I do is +4db so I just think like that.

The main advantage of the Q8 though is it can do "audio-only" recording and
I forsee the camera becoming far surpassed in a couple years - but still
having use for the unit as a reasonably high quality audio capture device.
Cheap video is changing fast while ADC and preamps not so much imho.

The F8 can't overdub - IOW record one channel at a time - and for video
that makes sense. I plan to load what I record as audio-only on the Q8 and
then run a sampler for some live session things to make up somewhat for a
lack of overdubs.



>
> > Best I can tell the typical workflow using Ardour for
> > multiple cameras, has a video software editing step in between recording
> > and Ardour.
>
> Right, assumes a traditional video based work flow where the video editing
> happens first, then the audio has to match up to the edited video.
>
> > However I googled and I couldn't find a Linux based UI that can read LTC
> -
> > besides XJadeo but for multiple videos that's not the right tool?
>
> Open source video editing on Linux is still pretty weak.  Cinelerra is the
> closest to something designed for a professional or semi-pro work flow.
> Cinelerra is confusing because there are three separate versions
> maintained simultaneously, might take some time to figure out which fork
> best fits what you want.
> Lightworks might be a good bet, it is no cost for the basic version, not
> Free Software, no source provided, no modifications, have to buy up to
> more features if you need them.  But it is high quality commercially
> supported video editing software for linux.
> Blender has a video editor, it is most known as animation software but
> supposedly the editor is pretty decent as well.
>

I loaded my q8.mov file with LTC into Cinelerra but it doesn't seem to be
able to read LTC. I looked at the docs and couldn't find anything related
to LTC. Entirely possible I am missing something.

Any other open source options?

I am probably going to look at Lightworks, it requires a registration so I
haven't decided yet.


> --
> Chris Caudle
>
>
>
See below for the script I am running. It divides the videos into (roughly)
10 second parts. It seemingly merges the LTC fine all the way thru and I
believe I just need to figure out the LTC frame size issue on the phone. Or
just use the q8 for all the cameras.

This script was a way for me to get into my shell comfort zone while
learning more about ffmpeg and ltcdump. Some ffmpeg flags may be wrong or
unneeded. I am a newbie and probably doing many things wrong. The script
was meant to be readable and creates a lot of debug info.

This may be the last script that tries to make the phone play nice with the
q8.

#!/bin/bash

# This script generates a single video from parts of videos from 2 cameras
by using ltc.
#
# Its purpose is to parse the ltc and split the videos from each camera
into
# roughly 10 second segments.
#
# After this script completes, the final step is to use a DAW to sync
# the audio from a Zoom F8 BWF containing timecode to the video created
# by this script, which still contains the LTC from each camera.

# The Ardour DAW was used in this project to sync the
# audio and final video generated by this script.
#
# http://manual.ardour.org/video-timeline/operations/
#
# This use case has one Moto X4 phone camera, one Zoom Q8 camera,
# and one Zoom F8 audio recorder to generate timecode and record
# 8 tracks onto a BWF file with timecode metadata. LTC is recorded
# onto ch1 of each camera, ch2 contains a scratch audio track from the F8
outputs.
#
# In this case I used the BNC out of the F8 into the phone camera ch1.
# I used a Tentacle Sync E that was "jammed" from the F8, to supply
# ltc into ch1 of the Zoom Q8.
#
# See below for the script that worked for me ymmv.
# Also, take extreme caution when playing any file with
# ltc as its an audio signal that can be very loud and
# even at lower levels it is unpleasant to listen to.
#
# usage:
# /home/myuser/input> ls
# motox_in_file.mp4  output  parseLTC.sh  q8.mov
# /home/myuser/input> cd output/
# /home/iksrazal/input/output> sh ../parseLTC.sh

# clear any text files from previous processing
rm -f *.txt
rm -f *all*
rm -f *out*

# 1) Most (all?) phone videos use a variable frame rate, convert it to a
constant frame rate

# strangely this command was creating CABAC / 3 Ref Frames without -refs 1
ffmpeg -y -v error -nostdin -i ../motox_in_file.mp4 -r 29.97 -crf 0 -c:a
pcm_s16le -c:v libx264 -refs 1 -x264opts b-pyramid=0 -crf 0 -s 1280x720
fixedmoto.mov

# trim files so they both start exactly at the same timecode of 00:26:55:00
ffmpeg -y -v error -ss 00:00:02.820 -t 00:02:15.400 -i fixedmoto.mov -c
copy mt.mov

ffmpeg -y -v error -ss 00:00:01.320 -t 00:02:15.250 -i ../q8.mov -c copy
q8t.mov

# debug
ffmpeg -y -v error -i ../motox_in_file.mp4 -vn -c:a pcm_s16le -ar 48000 -ac
2 motox_in_file.wav
ffmpeg -y -v error -i fixedmoto.mov -vn -c:a pcm_s16le -ar 48000 -ac 2
fixedmoto.wav
ffmpeg -y -v error -y -i mt.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 mt.wav
ffmpeg -y -v error -i q8t.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 q8t.wav

# 2) split file by key frames in a .07 second duration, need a couple
entries that
# ltcdump can find in each file - ideally just a single entry.
# Convert to same resolution as the q8 1280x720
# DCT-based audio codecs like MP3, AAC rely on neighbouring audio frames
for decoding.
# PCM is self-contained for decoding, so doesn't suffer from this.
# So transcode phone video to mov with pcm.
# Note that -r is placed before -i instead of after -i,
# it is to indicate that the video source is of the frame rate of 29.97
FPS.
# -crf "0" is to indicate x264 to encode the video in “lossless mode”.
# -refs 1 -x264opts b-pyramid=0 is to force the size of the DPB (Decoded
Picture Buffer)
ffmpeg -v error -fflags +genpts -r 29.97 -i mt.mov -c:a pcm_s16le -c:v
libx264 -refs 1 -x264opts b-pyramid=0 -crf 0 -s 1280x720 -segment_time 0.07
-segment_list phone.ffcat -sc_threshold 0 -force_key_frames
"expr:gte(t,n_forced*0.07)" -f segment -reset_timestamps 1 phone_out%03d.mov

# do the same thing for files from the Q8,
ffmpeg -v error -fflags +genpts -r 29.97 -i q8t.mov -c:a pcm_s16le -c:v
libx264 -refs 1 -x264opts b-pyramid=0 -crf 0 -segment_time 0.07
-segment_list q8.ffcat -sc_threshold 0 -force_key_frames
"expr:gte(t,n_forced*0.07)" -f segment -reset_timestamps 1 q8_out%03d.mov

# save the ffcat output to run again if need be while debugging
cp q8.ffcat sav_q8.ffcat
cp phone.ffcat sav_phone.ffcat

# 3)

# some errors I found while playing option bingo with ffmpeg
validate() {
    fileToProcess=''
    fileToProcess=$1
    epoch_secs_ltc_to_process=0
    ltc_to_process_formatted=''
    isLTCDumpOutputValid=0
    found_stop_time=0

    # test for shell error
    printf "\nExecuting: ltcdump -f 29.97 "$fileToProcess" "
    # adding frame rate removes this DISCONTINUITY
    # 00000000   00:26:53:24 |     7224     8824
    #DISCONTINUITY
    ltcdump -f 29.97 "${fileToProcess}" > /dev/null 2>&1
    if [ $? -ne 0 ] ; then
        printf "\nError processing file %s\n" "${fileToProcess}"
        printf "\nshell returned non zero value on validity check"
        return
    fi
    printf "\nExecuting: ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null |
grep -v '#' | grep ':' | wc -w "
    hasLTC=0
    hasLTC=`ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' |
grep ':' | wc -w`
    if [[ $hasLTC -eq 0 ]]; then
        printf "\nError processing file %s\n" "${fileToProcess}"
        printf "\ncannot parse timecode\n"
        return
    fi
    rm -f ltc.txt
    # find timecode in format 'HH:MM:SS' with ms trimmed, reject negative
values
    # remove occasional '.' in the form 00:00:00.0 instead of 00:00:00:0
    # remove negative values
    # disallow 0000000f   00:12:25:45
    printf "\nExecuting: ltcdump -fps 29.97 "${fileToProcess}" 2>/dev/null
| grep -v '#' | grep 00000000 | grep -v '\.' | grep -v '-' > ltc.txt"
    ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' | grep
00000000 | grep -v '\.' | grep -v '-' > ltc.txt
    lastTimecodeInSegment=0
    lastTimecodeInSegment=`tail -n 1 ltc.txt | awk '{ print $2 }' | sed
's/\(.*\):/\1./'  `
    # can sometimes receive unparsable dates
    if [[ ${#lastTimecodeInSegment} -ne 11 ]]; then
        lastTimecodeInSegment=0
        printf "\nError processing file %s\n" "${fileToProcess}"
        printf "\ntimecode number of chars is not correct: "
        printf " %s" "${#lastTimecodeInSegment}"
        return
    fi
    # can receive invalid time such as: 00000680   00:13:61:10 |
22     1609
    if ! date -d "$lastTimecodeInSegment" >/dev/null 2>&1; then
        printf "\nError processing file %s\n" "${fileToProcess}"
        printf "\ninvalid date format:" printf " %s"
"$lastTimecodeInSegment"
        return
    fi
    epoch_secs_ltc_to_process=$(date +%s --date="$timecode_date
${lastTimecodeInSegment}")
    ltc_to_process_formatted="$timecode_date ${lastTimecodeInSegment}"
    printf "\nltc_to_process_formatted: $ltc_to_process_formatted"
    if [[ $epoch_secs_ltc_to_process -ne 0 && $epoch_secs_stop_time -ne 0
&& $epoch_secs_ltc_to_process -ge $epoch_secs_stop_time ]]; then
        found_stop_time=1
        printf "\nskipping file %s\n" "${fileToProcess}"
        printf "\ntimecode found:"
        printf " %s" "${ltc_to_process_formatted}"
        printf "\nis after or equal to stop time: "
        printf " %s" "${epoch_secs_stop_time_formatted}"
        return
    fi
    printf "\nfileToProcess seems valid:"
    isLTCDumpOutputValid=1
}

# define timecode start time, just add date
timecode_date=2018-04-22
# skip segments before this timecode
epoch_secs_start_time=$(date +%s --date="$timecode_date 00:26:52")
start_time_formatted="$timecode_date 00:26:52.06"
# define timecode stop time
epoch_secs_stop_time=$(date +%s --date="$timecode_date 00:31:40")
stop_timecode=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00 +0000
$epoch_secs_stop_time seconds" | cut -b1-11  | sed 's/\(.*\):/\1./' `
stop_time_formatted="$timecode_date ${stop_timecode}"
timeDivisionInSeconds=20
let epoch_secs_timecode_to_find=$((epoch_secs_start_time +
timeDivisionInSeconds))
find_timecode=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00 +0000
$epoch_secs_timecode_to_find seconds" | cut -b1-11  | sed 's/\(.*\):/\1./'
`
find_timecode_formatted="$timecode_date ${find_timecode}"

let
epoch_secs_next_timecode_to_find=$epoch_secs_timecode_to_find+$timeDivisionInSeconds
next_timecode_to_find=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00 +0000
$epoch_secs_next_timecode_to_find seconds" | cut -b1-11  | sed
's/\(.*\):/\1./' `
next_timecode_to_find_formatted="$timecode_date ${next_timecode_to_find}"

phoneHasLTCStartTime=0
hasRejectBeforeTime=0
phoneTimeCodeInProgress=0
savePhoneCurrentTimeCodeInProgressAlreadyProcessed=0
rejectBeforeTime_formatted=''
savePhoneCurrentTimeCodeInProgress_to_find_formatted=''

while read i; do
    # skip auto generated version line
    if [[ $i =~ .*ffconcat.* ]]; then
       continue
    fi
    phoneVideoFile=`echo $i | cut -d " " -f2-`;
    if [[ ! -f "${phoneVideoFile}.wav" ]]; then
        # convert from mp4 to wav, so ltcdump can find the timecode
        ffmpeg -v error -nostdin -i $phoneVideoFile -vn -acodec pcm_s16le
-ar 48000 -ac 2 "${phoneVideoFile}.wav"
    fi
    validate "${phoneVideoFile}.wav"
    if [[ $found_stop_time -eq 1 ]]; then
        printf "\nphone video is after stop time, executing break\n"
        printf "%s\n" "${phoneVideoFile}"
        break
    fi
    if [[ $phoneHasLTCStartTime -eq 0 && $isLTCDumpOutputValid -eq 0 ]];
then
        printf "\non phoneHasLTCStartTime=0 and isLTCDumpOutputValid=0 ..
phone video is the default, occasional bad timecode values are ok"
        printf "\nadding video to file list to send to all.mp4: "
        printf "file %s\n" "${phoneVideoFile}"
        printf "file %s\n" "${phoneVideoFile}" >> all.txt
        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt
        continue
    fi
    if [[ $phoneHasLTCStartTime -eq 0 && $isLTCDumpOutputValid -eq 1 ]];
then
        dateDiff=0
        dateDiff=`date -d "$ltc_to_process_formatted $(date -d
"$start_time_formatted" +%s.%N) seconds ago" +%s.%N`
        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff"
        then
            phoneHasLTCStartTime=1
            printf "\non dateDiff $dateDiff , ltc_to_process_formatted
$ltc_to_process_formatted is later than or equal to start_time_formatted
$start_time_formatted"
            printf "\nproceeding on file %s\n" "${phoneVideoFile}"
        else
            printf "\non dateDiff $dateDiff , ltc_to_process_formatted
$ltc_to_process_formatted is before start_time_formatted
$start_time_formatted"
            printf "\nskipping file %s\n" "${phoneVideoFile}"
            continue
        fi
    fi
    if [[ $isLTCDumpOutputValid -eq 0 && $phoneTimeCodeInProgress -eq 1 ]];
then
        printf "\nphone video is the default, occasional bad timecode
values are ok"
        printf "\nadding video to file list to send to all.mp4: "
        printf "file %s\n" "${phoneVideoFile}"
        printf "file %s\n" "${phoneVideoFile}" >> all.txt
        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt
        continue
    fi
    if [[ $isLTCDumpOutputValid -eq 0 && $phoneTimeCodeInProgress -eq 0 ]];
then
        printf "\nskipping phone video file , ltc is invalid and
phoneTimeCodeInProgress is false: "
        printf "file %s\n" "${phoneVideoFile}"
        continue
    fi
    if [[ $hasRejectBeforeTime -eq 1 ]]; then
        dateDiff=0
        dateDiff=`date -d "$ltc_to_process_formatted $(date -d
"$rejectBeforeTime_formatted" +%s.%N) seconds ago" +%s.%N`

        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"
        then
            printf "\nexecuting continue on file "${phoneVideoFile}" ,
dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is
before or equal to rejectBeforeTime_formatted $rejectBeforeTime_formatted
\n"
            continue
        else
            printf "\nproceeding on file "${phoneVideoFile}" , dateDiff
$dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is after
$rejectBeforeTime_formatted \n"
        fi
    fi

    dateDiff=0
    dateDiff=`date -d "$ltc_to_process_formatted $(date -d
"$find_timecode_formatted" +%s.%N) seconds ago" +%s.%N`

    if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff"
    then
        printf "\non dateDiff $dateDiff , ltc_to_process_formatted
$ltc_to_process_formatted is greater than or equal to
find_timecode_formatted $find_timecode_formatted \n"
    else
        phoneTimeCodeInProgress=1
        printf "\non dateDiff $dateDiff , ltc_to_process_formatted
$ltc_to_process_formatted is less than find_timecode_formatted
$find_timecode_formatted \n"
        printf "\nadding video to file list to send to all.mp4: "
        printf "file %s\n" "${phoneVideoFile}"
        printf "file %s\n" "${phoneVideoFile}" >> all.txt
        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt
        continue
    fi

    printf "\nfound find_timecode: "
    printf " %s" "${find_timecode}"
    printf "\nin file: "
    printf " %s" "${phoneVideoFile}.wav"
    printf "\nwill now process the q8 files looking for timecode greater
than or equal to: "
    printf " %s" "${find_timecode_formatted}"
    printf "\nand timecode less than or equal to: "
    printf " %s" "${next_timecode_to_find_formatted}"
    phoneTimeCodeInProgress=0

savePhoneCurrentTimeCodeInProgress_to_find_formatted=$ltc_to_process_formatted
    savePhoneCurrentTimeCodeInProgressAlreadyProcessed=0
    saveQ8CurrentTimeCodeInProgressAlreadyProcessed=0
    while read f; do
        # skip auto generated version line
        if [[ $f =~ .*ffconcat.* ]]; then
           continue
        fi
        q8VideoFile=`echo $f | cut -d " " -f2-`;
        printf "%s\n" "${q8VideoFile}" >> q8_processed.txt
        # convert Q8 video segments to wav,
        # so that ltcdump can find the timecode
        if [[ ! -f "${q8VideoFile}.wav" ]]; then
            ffmpeg -v error -nostdin -i $q8VideoFile -vn -c:a pcm_s16le -ar
48000 -ac 2 "${q8VideoFile}.wav"
        fi
        validate "${q8VideoFile}.wav"
        if [[ $found_stop_time -eq 1 ]]; then
            printf "\nq8 video is after stop time, executing break\n"
            break
        fi
        if [[ $savePhoneCurrentTimeCodeInProgressAlreadyProcessed -eq 0 &&
$q8TimeCodeInProgress -eq 0 && $isLTCDumpOutputValid -eq 1 ]]; then
            savePhoneCurrentTimeCodeInProgressAlreadyProcessed=1

            dateDiff=0
            dateDiff=`date -d
"$savePhoneCurrentTimeCodeInProgress_to_find_formatted $(date -d
"$ltc_to_process_formatted" +%s.%N) seconds ago" +%s.%N`

            if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"
            then
                printf "\nadding phone file in q8 loop on dateDiff
$dateDiff , $savePhoneCurrentTimeCodeInProgress_to_find_formatted is less
than or equal to $ltc_to_process_formatted"
                printf "file %s\n" "${phoneVideoFile}" >> all.txt
                printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt
            else
                printf "\nin q8 loop no action taken on phone video file
"${phoneVideoFile}" , dateDiff $dateDiff ,
$savePhoneCurrentTimeCodeInProgress_to_find_formatted greater than
$ltc_to_process_formatted"
            fi
        fi
        if [[ $isLTCDumpOutputValid -eq 0 && $q8TimeCodeInProgress -eq 1
]]; then
            printf "\nfound LTC error while processing files in range, just
accept it"
            printf "\nadding video to q8 file processed list"
            printf "file %s\n" "${q8VideoFile}" >> all.txt
            printf "%s\n" "${q8VideoFile}.wav" >> debug.txt
            continue
        fi
        if [[ $isLTCDumpOutputValid -eq 0 ]]; then
            printf "\nFound ltc error outside time range while processing a
q8 file out of range, reject all q8 videos when this happens"
            printf "\nskipping file: "
            printf " %s" "${q8VideoFile}"
            continue
        fi
        dateDiff=0
        dateDiff=`date -d "$ltc_to_process_formatted $(date -d
"$find_timecode_formatted" +%s.%N) seconds ago" +%s.%N`
        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff"
        then
            printf "\nproceeding on file "${q8VideoFile}" , dateDiff
$dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is greater
than or equal to find_timecode_formatted $find_timecode_formatted"
        else
            printf "\nskipping file "${q8VideoFile}" on dateDiff $dateDiff
, ltc_to_process_formatted $ltc_to_process_formatted is before
find_timecode_formatted $find_timecode_formatted"
            continue
        fi

        dateDiff=0
        dateDiff=`date -d "$ltc_to_process_formatted $(date -d
"$next_timecode_to_find_formatted" +%s.%N) seconds ago" +%s.%N`

        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"
        then
            printf "\nproceeding on dateDiff $dateDiff ,
$ltc_to_process_formatted is less than or equal to
$next_timecode_to_find_formatted"
        else
            printf "\nexecuting break on file "${q8VideoFile}" , dateDiff
$dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is greater
than next_timecode_to_find $next_timecode_to_find"
            break
        fi

        q8TimeCodeInProgress=1
        printf "\nfound ltc in range"
        printf "\nadding video to q8 file processed list"
        printf "file %s\n" "${q8VideoFile}" >> all.txt
        printf "%s\n" "${q8VideoFile}.wav" >> debug.txt

  done < q8.ffcat
  q8TimeCodeInProgress=0
  if [[ ! -f "q8_processed.txt" ]]; then
      printf "\n\nCould not find file: q8_processed.txt , no timecode in q8
files found between $timecode_to_find and $next_timecode_to_find\n"
      exit
  else
      printf "\nq8 loop completed, removing files process from queue by:
grep -F -v -f q8_processed.txt q8.ffcat > q8_files_not_processed.txt"
      grep -F -v -f q8_processed.txt q8.ffcat > q8_files_not_processed.txt
      mv q8_files_not_processed.txt q8.ffcat
  fi
  # reset everything for next loop
  let epoch_secs_rejectBeforeTime=$epoch_secs_next_timecode_to_find+1
  reject_timecode=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00 +0000
$epoch_secs_rejectBeforeTime seconds" | cut -b1-11  | sed 's/\(.*\):/\1./'
`
  rejectBeforeTime_formatted="$timecode_date ${reject_timecode}"
  hasRejectBeforeTime=1
  increment=$(( $timeDivisionInSeconds * 2 ))
  let epoch_secs_timecode_to_find=$epoch_secs_timecode_to_find+$increment
  find_timecode=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00 +0000
$epoch_secs_timecode_to_find seconds" | cut -b1-11 | sed 's/\(.*\):/\1./' `
  find_timecode_formatted="$timecode_date ${find_timecode}"
  let
epoch_secs_next_timecode_to_find=$epoch_secs_next_timecode_to_find+$increment
  next_timecode_to_find=`date +%H:%M:%S:%N --date="Jan 1, 1970 00:00:00
+0000 $epoch_secs_next_timecode_to_find seconds" | cut -b1-11  | sed
's/\(.*\):/\1./' `
  next_timecode_to_find_formatted="$timecode_date ${next_timecode_to_find}"
  printf "\nloop completed, timecode_to_find has been reset: "
  printf " %s" "${find_timecode_formatted}"
  printf "\nnext_timecode_to_find_formatted has been reset: "
  printf " %s" "${next_timecode_to_find_formatted}"
  printf "\nrejectBeforeTime_formatted has been reset: "
  printf " %s" "${rejectBeforeTime_formatted}"
done < phone.ffcat

printf "\nExecuting: ffmpeg -v error -nostdin -f concat -fflags +genpts
-async 1 -safe 0 -r 29.97 -i all.txt -c copy -crf 0 all.mov"
ffmpeg -y -v error -nostdin -f concat -fflags +genpts -async 1 -safe 0 -r
29.97 -i all.txt -c copy -refs 1 -x264opts b-pyramid=0 -crf 0 all.mov

# debug
ffmpeg -y -i all.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 all.wav

# can't figure out why the concat is creating a variable rate when the
segment creates 29.97
ffmpeg -y -v error -nostdin -i all.mov -r 29.97 -refs 1 -x264opts
b-pyramid=0 -crf 0 -c:a pcm_s16le  -c:v libx264 fixedall.mov

# debug
ffmpeg -y -v error -i fixedall.mov -vn -c:a pcm_s16le -ar 48000 -ac 2
fixedall.wav

while read wavFile; do
    ltc_out=`ltcdump $wavFile 2>/dev/null `
    printf "### output from file %s\n\n" "${wavFile}" >> debug_out.txt
    printf "%s\n\n" "${ltc_out}" >> debug_out.txt
done < debug.txt | sort -V

exit

_______________________________________________
Ardour-Users mailing list
[email protected]
To unsubscribe  or change your mailing preferences please visit:
http://lists.ardour.org/listinfo.cgi/ardour-users-ardour.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.