<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 21, 2018 at 8:54 PM, Chris Caudle <span dir="ltr"><<a href="mailto:chris@chriscaudle.org" target="_blank">chris@chriscaudle.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-">On Fri, April 20, 2018 11:49 am, robertlazarski wrote:<br>
> The phone problem with Ardour was indeed because it was a variable rate<br>
> issue. I was able to fix it with this command. And then Ardour was fine<br>
> with it.<br>
<br>
</span>That's good to know.  Did we coincidentally find that near the same time,<br>
or did my noticing the original was variable frame rate prompt some<br>
experiments to check it out?<br></blockquote><div><br></div><div>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. <br><br></div><div>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. <br><br></div><div>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.<br><br></div><div># phone video in mp4 format and AAC audio, cannot fix this with ffmpeg by any conversion I tried<br></div><div>00000000   00:26:55:01 |     3118     4715  # (4715 - 3118) = 1597<br><br></div><div># q8 mov video and PCM audio<br>00000000   00:26:55:01 |     3123     4724 # (4724 - 3132) = 1601<br><br></div><div>Any idea how to fix this? <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-"><br>
>  The Tentacle Sync LTC generator also works fine and I'm really happy<br>
with it.<br>
<br>
</span>Seems like a cool little device, I was not previously familiar with it.<br></blockquote><div><br></div><div>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. <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-"><br>
> To be clear my priority is good audio and then whatever video<br>
> that comes with it is ok for me.<br>
<br>
</span>That is what the 8 channel Zoom audio recorder is for, right?  I assumed<br>
you were using a traditional arrangement where you only needed the camera<br>
to record timecode, all the main audio would go to the multichannel<br>
recorder, so camera audio quality wasn't really a consideration.<br></blockquote><div><br><br></div><div>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. <br><br>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. <br><br></div><div>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. <br></div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-"><br>
> Best I can tell the typical workflow using Ardour for<br>
> multiple cameras, has a video software editing step in between recording<br>
> and Ardour.<br>
<br>
</span>Right, assumes a traditional video based work flow where the video editing<br>
happens first, then the audio has to match up to the edited video.<br>
<span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-"><br>
> However I googled and I couldn't find a Linux based UI that can read LTC -<br>
> besides XJadeo but for multiple videos that's not the right tool?<br>
<br>
</span>Open source video editing on Linux is still pretty weak.  Cinelerra is the<br>
closest to something designed for a professional or semi-pro work flow. <br>
Cinelerra is confusing because there are three separate versions<br>
maintained simultaneously, might take some time to figure out which fork<br>
best fits what you want.<br>
Lightworks might be a good bet, it is no cost for the basic version, not<br>
Free Software, no source provided, no modifications, have to buy up to<br>
more features if you need them.  But it is high quality commercially<br>
supported video editing software for linux.<br>
Blender has a video editor, it is most known as animation software but<br>
supposedly the editor is pretty decent as well.<br></blockquote><div><br></div><div>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. <br><br>Any other open source options?<br></div><div><br>I am probably going to look at Lightworks, it requires a registration so I haven't decided yet. <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_3938501188452719552gmail-m_1664400412656531893m_-3384594614210866445gmail-HOEnZb"><font color="#888888"><br>
-- <br>
Chris Caudle<br>
<br>
<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">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. <br><br></div><div class="gmail_extra">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.<br><br></div><div class="gmail_extra">This may be the last script that tries to make the phone play nice with the q8. <br><br>#!/bin/bash<br><br># This script generates a single video from parts of videos from 2 cameras by using ltc.<br>#<br># Its purpose is to parse the ltc and split the videos from each camera into <br># roughly 10 second segments.<br>#<br># After this script completes, the final step is to use a DAW to sync <br># the audio from a Zoom F8 BWF containing timecode to the video created <br># by this script, which still contains the LTC from each camera. <br><br># The Ardour DAW was used in this project to sync the <br># audio and final video generated by this script. <br># <br># <a href="http://manual.ardour.org/video-timeline/operations/">http://manual.ardour.org/video-timeline/operations/</a><br># <br># This use case has one Moto X4 phone camera, one Zoom Q8 camera, <br># and one Zoom F8 audio recorder to generate timecode and record <br># 8 tracks onto a BWF file with timecode metadata. LTC is recorded<br># onto ch1 of each camera, ch2 contains a scratch audio track from the F8 outputs.<br># <br># In this case I used the BNC out of the F8 into the phone camera ch1. <br># I used a Tentacle Sync E that was "jammed" from the F8, to supply <br># ltc into ch1 of the Zoom Q8.<br>#<br># See below for the script that worked for me ymmv. <br># Also, take extreme caution when playing any file with<br># ltc as its an audio signal that can be very loud and <br># even at lower levels it is unpleasant to listen to. <br>#<br># usage:<br># /home/myuser/input> ls<br># motox_in_file.mp4  output  parseLTC.sh  q8.mov<br># /home/myuser/input> cd output/<br># /home/iksrazal/input/output> sh ../parseLTC.sh<br><br># clear any text files from previous processing<br>rm -f *.txt<br>rm -f *all*<br>rm -f *out*<br><br># 1) Most (all?) phone videos use a variable frame rate, convert it to a constant frame rate<br><br># strangely this command was creating CABAC / 3 Ref Frames without -refs 1<br>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 <br><br># trim files so they both start exactly at the same timecode of 00:26:55:00<br>ffmpeg -y -v error -ss 00:00:02.820 -t 00:02:15.400 -i fixedmoto.mov -c copy mt.mov<br><br>ffmpeg -y -v error -ss 00:00:01.320 -t 00:02:15.250 -i ../q8.mov -c copy q8t.mov<br><br># debug<br>ffmpeg -y -v error -i ../motox_in_file.mp4 -vn -c:a pcm_s16le -ar 48000 -ac 2 motox_in_file.wav<br>ffmpeg -y -v error -i fixedmoto.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 fixedmoto.wav <br>ffmpeg -y -v error -y -i mt.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 mt.wav<br>ffmpeg -y -v error -i q8t.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 q8t.wav<br><br># 2) split file by key frames in a .07 second duration, need a couple entries that <br># ltcdump can find in each file - ideally just a single entry. <br># Convert to same resolution as the q8 1280x720<br># DCT-based audio codecs like MP3, AAC rely on neighbouring audio frames for decoding. <br># PCM is self-contained for decoding, so doesn't suffer from this. <br># So transcode phone video to mov with pcm.<br># Note that -r is placed before -i instead of after -i, <br># it is to indicate that the video source is of the frame rate of 29.97 FPS. <br># -crf "0" is to indicate x264 to encode the video in “lossless mode”. <br># -refs 1 -x264opts b-pyramid=0 is to force the size of the DPB (Decoded Picture Buffer)<br>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<br><br># do the same thing for files from the Q8, <br>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<br><br># save the ffcat output to run again if need be while debugging<br>cp q8.ffcat sav_q8.ffcat<br>cp phone.ffcat sav_phone.ffcat<br><br># 3) <br><br># some errors I found while playing option bingo with ffmpeg<br>validate() {<br>    fileToProcess=''<br>    fileToProcess=$1<br>    epoch_secs_ltc_to_process=0<br>    ltc_to_process_formatted=''<br>    isLTCDumpOutputValid=0<br>    found_stop_time=0<br>  <br>    # test for shell error<br>    printf "\nExecuting: ltcdump -f 29.97 "$fileToProcess" "<br>    # adding frame rate removes this DISCONTINUITY<br>    # 00000000   00:26:53:24 |     7224     8824  <br>    #DISCONTINUITY<br>    ltcdump -f 29.97 "${fileToProcess}" > /dev/null 2>&1<br>    if [ $? -ne 0 ] ; then<br>        printf "\nError processing file %s\n" "${fileToProcess}"<br>        printf "\nshell returned non zero value on validity check"<br>        return<br>    fi<br>    printf "\nExecuting: ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' | grep ':' | wc -w "<br>    hasLTC=0<br>    hasLTC=`ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' | grep ':' | wc -w`<br>    if [[ $hasLTC -eq 0 ]]; then<br>        printf "\nError processing file %s\n" "${fileToProcess}"<br>        printf "\ncannot parse timecode\n"<br>        return<br>    fi<br>    rm -f ltc.txt<br>    # find timecode in format 'HH:MM:SS' with ms trimmed, reject negative values<br>    # remove occasional '.' in the form 00:00:00.0 instead of 00:00:00:0 <br>    # remove negative values<br>    # disallow 0000000f   00:12:25:45<br>    printf "\nExecuting: ltcdump -fps 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' | grep 00000000 | grep -v '\.' | grep -v '-' > ltc.txt"<br>    ltcdump -f 29.97 "${fileToProcess}" 2>/dev/null | grep -v '#' | grep 00000000 | grep -v '\.' | grep -v '-' > ltc.txt<br>    lastTimecodeInSegment=0<br>    lastTimecodeInSegment=`tail -n 1 ltc.txt | awk '{ print $2 }' | sed 's/\(.*\):/\1./'  `<br>    # can sometimes receive unparsable dates<br>    if [[ ${#lastTimecodeInSegment} -ne 11 ]]; then<br>        lastTimecodeInSegment=0<br>        printf "\nError processing file %s\n" "${fileToProcess}"<br>        printf "\ntimecode number of chars is not correct: "<br>        printf " %s" "${#lastTimecodeInSegment}"<br>        return<br>    fi<br>    # can receive invalid time such as: 00000680   00:13:61:10 |       22     1609<br>    if ! date -d "$lastTimecodeInSegment" >/dev/null 2>&1; then<br>        printf "\nError processing file %s\n" "${fileToProcess}"<br>        printf "\ninvalid date format:" printf " %s" "$lastTimecodeInSegment"<br>        return<br>    fi<br>    epoch_secs_ltc_to_process=$(date +%s --date="$timecode_date ${lastTimecodeInSegment}")<br>    ltc_to_process_formatted="$timecode_date ${lastTimecodeInSegment}"<br>    printf "\nltc_to_process_formatted: $ltc_to_process_formatted"<br>    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<br>        found_stop_time=1<br>        printf "\nskipping file %s\n" "${fileToProcess}"<br>        printf "\ntimecode found:"<br>        printf " %s" "${ltc_to_process_formatted}"<br>        printf "\nis after or equal to stop time: "<br>        printf " %s" "${epoch_secs_stop_time_formatted}"<br>        return<br>    fi<br>    printf "\nfileToProcess seems valid:"<br>    isLTCDumpOutputValid=1<br>}<br><br># define timecode start time, just add date<br>timecode_date=2018-04-22<br># skip segments before this timecode<br>epoch_secs_start_time=$(date +%s --date="$timecode_date 00:26:52")<br>start_time_formatted="$timecode_date 00:26:52.06"<br># define timecode stop time<br>epoch_secs_stop_time=$(date +%s --date="$timecode_date 00:31:40")<br>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./' ` <br>stop_time_formatted="$timecode_date ${stop_timecode}"<br>timeDivisionInSeconds=20<br>let epoch_secs_timecode_to_find=$((epoch_secs_start_time + timeDivisionInSeconds))<br>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./' ` <br>find_timecode_formatted="$timecode_date ${find_timecode}"<br><br>let epoch_secs_next_timecode_to_find=$epoch_secs_timecode_to_find+$timeDivisionInSeconds<br>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./' ` <br>next_timecode_to_find_formatted="$timecode_date ${next_timecode_to_find}"<br><br>phoneHasLTCStartTime=0<br>hasRejectBeforeTime=0<br>phoneTimeCodeInProgress=0<br>savePhoneCurrentTimeCodeInProgressAlreadyProcessed=0<br>rejectBeforeTime_formatted=''<br>savePhoneCurrentTimeCodeInProgress_to_find_formatted=''<br><br>while read i; do<br>    # skip auto generated version line<br>    if [[ $i =~ .*ffconcat.* ]]; then<br>       continue<br>    fi<br>    phoneVideoFile=`echo $i | cut -d " " -f2-`;<br>    if [[ ! -f "${phoneVideoFile}.wav" ]]; then<br>        # convert from mp4 to wav, so ltcdump can find the timecode<br>        ffmpeg -v error -nostdin -i $phoneVideoFile -vn -acodec pcm_s16le -ar 48000 -ac 2 "${phoneVideoFile}.wav"<br>    fi<br>    validate "${phoneVideoFile}.wav"<br>    if [[ $found_stop_time -eq 1 ]]; then<br>        printf "\nphone video is after stop time, executing break\n"<br>        printf "%s\n" "${phoneVideoFile}"<br>        break<br>    fi<br>    if [[ $phoneHasLTCStartTime -eq 0 && $isLTCDumpOutputValid -eq 0 ]]; then<br>        printf "\non phoneHasLTCStartTime=0 and isLTCDumpOutputValid=0 .. phone video is the default, occasional bad timecode values are ok"<br>        printf "\nadding video to file list to send to all.mp4: "<br>        printf "file %s\n" "${phoneVideoFile}"<br>        printf "file %s\n" "${phoneVideoFile}" >> all.txt<br>        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt<br>        continue<br>    fi<br>    if [[ $phoneHasLTCStartTime -eq 0 && $isLTCDumpOutputValid -eq 1 ]]; then<br>        dateDiff=0<br>        dateDiff=`date -d "$ltc_to_process_formatted $(date -d "$start_time_formatted" +%s.%N) seconds ago" +%s.%N`<br>        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff"<br>        then<br>            phoneHasLTCStartTime=1<br>            printf "\non dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is later than or equal to start_time_formatted $start_time_formatted"<br>            printf "\nproceeding on file %s\n" "${phoneVideoFile}"<br>        else<br>            printf "\non dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is before start_time_formatted $start_time_formatted"<br>            printf "\nskipping file %s\n" "${phoneVideoFile}"<br>            continue<br>        fi<br>    fi<br>    if [[ $isLTCDumpOutputValid -eq 0 && $phoneTimeCodeInProgress -eq 1 ]]; then<br>        printf "\nphone video is the default, occasional bad timecode values are ok"<br>        printf "\nadding video to file list to send to all.mp4: "<br>        printf "file %s\n" "${phoneVideoFile}"<br>        printf "file %s\n" "${phoneVideoFile}" >> all.txt<br>        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt<br>        continue<br>    fi<br>    if [[ $isLTCDumpOutputValid -eq 0 && $phoneTimeCodeInProgress -eq 0 ]]; then<br>        printf "\nskipping phone video file , ltc is invalid and phoneTimeCodeInProgress is false: "<br>        printf "file %s\n" "${phoneVideoFile}"<br>        continue<br>    fi<br>    if [[ $hasRejectBeforeTime -eq 1 ]]; then<br>        dateDiff=0<br>        dateDiff=`date -d "$ltc_to_process_formatted $(date -d "$rejectBeforeTime_formatted" +%s.%N) seconds ago" +%s.%N`<br>        <br>        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"<br>        then<br>            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"<br>            continue<br>        else<br>            printf "\nproceeding on file "${phoneVideoFile}" , dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is after $rejectBeforeTime_formatted \n"<br>        fi<br>    fi<br>  <br>    dateDiff=0<br>    dateDiff=`date -d "$ltc_to_process_formatted $(date -d "$find_timecode_formatted" +%s.%N) seconds ago" +%s.%N`<br>    <br>    if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff" <br>    then<br>        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"<br>    else<br>        phoneTimeCodeInProgress=1<br>        printf "\non dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is less than find_timecode_formatted $find_timecode_formatted \n"<br>        printf "\nadding video to file list to send to all.mp4: "<br>        printf "file %s\n" "${phoneVideoFile}"<br>        printf "file %s\n" "${phoneVideoFile}" >> all.txt<br>        printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt<br>        continue<br>    fi<br><br>    printf "\nfound find_timecode: "<br>    printf " %s" "${find_timecode}"<br>    printf "\nin file: "<br>    printf " %s" "${phoneVideoFile}.wav"<br>    printf "\nwill now process the q8 files looking for timecode greater than or equal to: "<br>    printf " %s" "${find_timecode_formatted}"<br>    printf "\nand timecode less than or equal to: "<br>    printf " %s" "${next_timecode_to_find_formatted}"<br>    phoneTimeCodeInProgress=0<br>    savePhoneCurrentTimeCodeInProgress_to_find_formatted=$ltc_to_process_formatted<br>    savePhoneCurrentTimeCodeInProgressAlreadyProcessed=0<br>    saveQ8CurrentTimeCodeInProgressAlreadyProcessed=0<br>    while read f; do<br>        # skip auto generated version line<br>        if [[ $f =~ .*ffconcat.* ]]; then<br>           continue<br>        fi<br>        q8VideoFile=`echo $f | cut -d " " -f2-`;<br>        printf "%s\n" "${q8VideoFile}" >> q8_processed.txt<br>        # convert Q8 video segments to wav,<br>        # so that ltcdump can find the timecode<br>        if [[ ! -f "${q8VideoFile}.wav" ]]; then<br>            ffmpeg -v error -nostdin -i $q8VideoFile -vn -c:a pcm_s16le -ar 48000 -ac 2 "${q8VideoFile}.wav"<br>        fi<br>        validate "${q8VideoFile}.wav"<br>        if [[ $found_stop_time -eq 1 ]]; then<br>            printf "\nq8 video is after stop time, executing break\n"<br>            break<br>        fi<br>        if [[ $savePhoneCurrentTimeCodeInProgressAlreadyProcessed -eq 0 && $q8TimeCodeInProgress -eq 0 && $isLTCDumpOutputValid -eq 1 ]]; then<br>            savePhoneCurrentTimeCodeInProgressAlreadyProcessed=1<br><br>            dateDiff=0<br>            dateDiff=`date -d "$savePhoneCurrentTimeCodeInProgress_to_find_formatted $(date -d "$ltc_to_process_formatted" +%s.%N) seconds ago" +%s.%N`<br>            <br>            if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"<br>            then<br>                printf "\nadding phone file in q8 loop on dateDiff $dateDiff , $savePhoneCurrentTimeCodeInProgress_to_find_formatted is less than or equal to $ltc_to_process_formatted"<br>                printf "file %s\n" "${phoneVideoFile}" >> all.txt<br>                printf "%s\n" "${phoneVideoFile}.wav" >> debug.txt<br>            else<br>                printf "\nin q8 loop no action taken on phone video file "${phoneVideoFile}" , dateDiff $dateDiff , $savePhoneCurrentTimeCodeInProgress_to_find_formatted greater than $ltc_to_process_formatted"<br>            fi<br>        fi<br>        if [[ $isLTCDumpOutputValid -eq 0 && $q8TimeCodeInProgress -eq 1 ]]; then<br>            printf "\nfound LTC error while processing files in range, just accept it"<br>            printf "\nadding video to q8 file processed list"<br>            printf "file %s\n" "${q8VideoFile}" >> all.txt<br>            printf "%s\n" "${q8VideoFile}.wav" >> debug.txt<br>            continue<br>        fi<br>        if [[ $isLTCDumpOutputValid -eq 0 ]]; then<br>            printf "\nFound ltc error outside time range while processing a q8 file out of range, reject all q8 videos when this happens"<br>            printf "\nskipping file: "<br>            printf " %s" "${q8VideoFile}"<br>            continue<br>        fi<br>        dateDiff=0<br>        dateDiff=`date -d "$ltc_to_process_formatted $(date -d "$find_timecode_formatted" +%s.%N) seconds ago" +%s.%N`<br>        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "0" "$dateDiff" <br>        then<br>            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"<br>        else<br>            printf "\nskipping file "${q8VideoFile}" on dateDiff $dateDiff , ltc_to_process_formatted $ltc_to_process_formatted is before find_timecode_formatted $find_timecode_formatted"<br>            continue<br>        fi<br><br>        dateDiff=0<br>        dateDiff=`date -d "$ltc_to_process_formatted $(date -d "$next_timecode_to_find_formatted" +%s.%N) seconds ago" +%s.%N`<br><br>        if awk 'BEGIN{exit ARGV[1]>ARGV[2]}' "$dateDiff" "0"<br>        then<br>            printf "\nproceeding on dateDiff $dateDiff , $ltc_to_process_formatted is less than or equal to $next_timecode_to_find_formatted"<br>        else<br>            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"<br>            break<br>        fi<br><br>        q8TimeCodeInProgress=1<br>        printf "\nfound ltc in range"<br>        printf "\nadding video to q8 file processed list"<br>        printf "file %s\n" "${q8VideoFile}" >> all.txt<br>        printf "%s\n" "${q8VideoFile}.wav" >> debug.txt<br><br>  done < q8.ffcat<br>  q8TimeCodeInProgress=0<br>  if [[ ! -f "q8_processed.txt" ]]; then<br>      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"<br>      exit<br>  else<br>      printf "\nq8 loop completed, removing files process from queue by: grep -F -v -f q8_processed.txt q8.ffcat > q8_files_not_processed.txt"<br>      grep -F -v -f q8_processed.txt q8.ffcat > q8_files_not_processed.txt<br>      mv q8_files_not_processed.txt q8.ffcat<br>  fi<br>  # reset everything for next loop<br>  let epoch_secs_rejectBeforeTime=$epoch_secs_next_timecode_to_find+1<br>  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./' ` <br>  rejectBeforeTime_formatted="$timecode_date ${reject_timecode}"<br>  hasRejectBeforeTime=1<br>  increment=$(( $timeDivisionInSeconds * 2 ))<br>  let epoch_secs_timecode_to_find=$epoch_secs_timecode_to_find+$increment<br>  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./' ` <br>  find_timecode_formatted="$timecode_date ${find_timecode}"<br>  let epoch_secs_next_timecode_to_find=$epoch_secs_next_timecode_to_find+$increment<br>  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./' ` <br>  next_timecode_to_find_formatted="$timecode_date ${next_timecode_to_find}"<br>  printf "\nloop completed, timecode_to_find has been reset: "<br>  printf " %s" "${find_timecode_formatted}"<br>  printf "\nnext_timecode_to_find_formatted has been reset: "<br>  printf " %s" "${next_timecode_to_find_formatted}"<br>  printf "\nrejectBeforeTime_formatted has been reset: "<br>  printf " %s" "${rejectBeforeTime_formatted}"<br>done < phone.ffcat<br><br>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"<br>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<br><br># debug<br>ffmpeg -y -i all.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 all.wav<br><br># can't figure out why the concat is creating a variable rate when the segment creates 29.97<br>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 <br><br># debug<br>ffmpeg -y -v error -i fixedall.mov -vn -c:a pcm_s16le -ar 48000 -ac 2 fixedall.wav<br><br>while read wavFile; do<br>    ltc_out=`ltcdump $wavFile 2>/dev/null `<br>    printf "### output from file %s\n\n" "${wavFile}" >> debug_out.txt<br>    printf "%s\n\n" "${ltc_out}" >> debug_out.txt<br>done < debug.txt | sort -V <br><br>exit<br><br><br><br></div><div class="gmail_extra"><br></div></div>