Audio Wav with TC to audio mxf op-atom

Questions and answers on how to get the most out of FFAStrans
Post Reply
andrezagato
Posts: 43
Joined: Tue Jun 09, 2020 4:07 pm

Audio Wav with TC to audio mxf op-atom

Post by andrezagato »

Hello,
I am trying to convert audio wave files into mxf opatom audio files with Ffastrans. And convert the timecode to 29.97DF standart.
The conversion works fine, but the timecode part it is a problem.

1) FFastrans picks up the file as a 25 fps framerate, even though it is 29.97 NDF.
2) Using the %start_tc% variable, it picks up a tc that is a little bit off from what it reads in Avid or Davinci. Both Avid and Davinci reads the TC exactly the same!

here is what comes out of FFastrans

Code: Select all

name D24_2403_A_RS03_BALADAVITRINI_230323_001_TR1
frame rate 25,
duration tc 00:20:16:00,
start tc 23:40:15:23,
I am trying to figure it out, using %info_exiftool% and %info_mediainfo% but the closest I got from a tc with this information was at "Duration String3", but it is HH:MM:SS:MILISSECOND.

How can I get ffastrans to match the TC showed on Davinci? Is there somewhere else I could look into?

Code: Select all

 {
  "creatingLibrary": {
    "name": "MediaInfoLib",
    "version": "21.09",
    "url": "https://mediaarea.net/MediaInfo"
  },
  "media": {
    "@ref": "E:\\IN\\D24_2403_A_RS03_BALADAVITRINI_230323_001_TR1.WAV",
    "track": [
      {
        "@type": "General",
        "Count": "333",
        "StreamCount": "1",
        "StreamKind": "General",
        "StreamKind_String": "General",
        "StreamKindID": "0",
        "AudioCount": "1",
        "Audio_Format_List": "PCM",
        "Audio_Format_WithHint_List": "PCM",
        "Audio_Codec_List": "PCM",
        "CompleteName": "E:\\IN\\D24_2403_A_RS03_BALADAVITRINI_230323_001_TR1.WAV",
        "FolderName": "E:\\IN",
        "FileNameExtension": "D24_2403_A_RS03_BALADAVITRINI_230323_001_TR1.WAV",
        "FileName": "D24_2403_A_RS03_BALADAVITRINI_230323_001_TR1",
        "FileExtension": "WAV",
        "Format": "Wave",
        "Format_String": "Wave",
        "Format_Extensions": "act at9 wav",
        "Format_Commercial": "Wave",
        "InternetMediaType": "audio/vnd.wave",
        "FileSize": "175237202",
        "FileSize_String": "167 MiB",
        "FileSize_String1": "167 MiB",
        "FileSize_String2": "167 MiB",
        "FileSize_String3": "167 MiB",
        "FileSize_String4": "167.1 MiB",
        "Duration": "1216.015",
        "Duration_String": "20 min 16 s",
        "Duration_String1": "20 min 16 s 15 ms",
        "Duration_String2": "20 min 16 s",
        "Duration_String3": "00:20:16.015",
        "Duration_String5": "00:20:16.015",
        "OverallBitRate_Mode": "CBR",
        "OverallBitRate_Mode_String": "Constant",
        "OverallBitRate": "1152862",
        "OverallBitRate_String": "1 153 kb/s",
        "StreamSize": "131072",
        "StreamSize_String": "128 KiB (0%)",
        "StreamSize_String1": "128 KiB",
        "StreamSize_String2": "128 KiB",
        "StreamSize_String3": "128 KiB",
        "StreamSize_String4": "128.0 KiB",
        "StreamSize_String5": "128 KiB (0%)",
        "StreamSize_Proportion": "0.00075",
        "Producer": "ZOOM F8",
        "Description": "zSPEED=29.970D / zTAKE=001 / zUBITS=00000000 / zSCENE=A_RS03_BAL / zTAPE= / zCIRCLED=FALSE / zTRK3=RICK / zTRK4=MISSIS / zTRK5=TRIS / zTRK6=TIAGO / zTRK7=JAPA / zTRK8=HELENA / zNOTE=X",
        "Encoded_Date": "2023-03-23 23:40:02",
        "File_Created_Date": "UTC 2023-04-22 01:40:53.130",
        "File_Created_Date_Local": "2023-04-21 22:40:53.130",
        "File_Modified_Date": "UTC 2023-03-24 03:00:18.000",
        "File_Modified_Date_Local": "2023-03-24 00:00:18.000",
        "Encoded_Library_Settings": "A=PCM,F=48000,W=24,M=mono,T=F8;VERSION=1.10;1:1 0 0 CNTR   00;2:1 0 0 CNTR   00;3:1 0 0 CNTR + 05;4:1 0 0 CNTR - 05;5:1 0 0 CNTR   00;6:1 0 0 CNTR + 05;7:0 0 0 CNTR MUTE;8:0 0 0 CNTR -120;L:0 1 0 CNTR   00;R:0 1 0 CNTR   00;FaderOffset=  00   00   00   00   00   00   00   00;",
        "extra": {
          "bext_Present": "Yes",
          "bext_Version": "1"
        }
      },
      {
        "@type": "Audio",
        "Count": "280",
        "StreamCount": "1",
        "StreamKind": "Audio",
        "StreamKind_String": "Audio",
        "StreamKindID": "0",
        "Format": "PCM",
        "Format_String": "PCM",
        "Format_Commercial": "PCM",
        "Format_Settings": "Little / Signed",
        "Format_Settings_Endianness": "Little",
        "Format_Settings_Sign": "Signed",
        "CodecID": "1",
        "CodecID_Url": "http://www.microsoft.com/windows/",
        "Duration": "1216.015",
        "Duration_String": "20 min 16 s",
        "Duration_String1": "20 min 16 s 15 ms",
        "Duration_String2": "20 min 16 s",
        "Duration_String3": "00:20:16.015",
        "Duration_String5": "00:20:16.015",
        "BitRate_Mode": "CBR",
        "BitRate_Mode_String": "Constant",
        "BitRate": "1152000",
        "BitRate_String": "1 152 kb/s",
        "Channels": "1",
        "Channels_String": "1 channel",
        "SamplingRate": "48000",
        "SamplingRate_String": "48.0 kHz",
        "SamplingCount": "58368710",
        "BitDepth": "24",
        "BitDepth_String": "24 bits",
        "Delay": "85215.931",
        "Delay_String": "23 h 40 min",
        "Delay_String1": "23 h 40 min 15 s 931 ms",
        "Delay_String2": "23 h 40 min",
        "Delay_String3": "23:40:15.931",
        "Delay_Source": "Container (bext)",
        "Delay_Source_String": "Container (bext)",
        "StreamSize": "175106130",
        "StreamSize_String": "167 MiB (100%)",
        "StreamSize_String1": "167 MiB",
        "StreamSize_String2": "167 MiB",
        "StreamSize_String3": "167 MiB",
        "StreamSize_String4": "167.0 MiB",
        "StreamSize_String5": "167 MiB (100%)",
        "StreamSize_Proportion": "0.99925"
      }
    ]
  }
}
I've tested with several other files, and the behavior is similar. Always off by a few frames!
Can you help me steer in the right direction ?!

Thanks guys!
Attachments
Davinci TC read and duration
Davinci TC read and duration
Screenshot 2023-04-27 172122.png (31.5 KiB) Viewed 3346 times
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Audio Wav with TC to audio mxf op-atom

Post by emcodem »

No problemo, in a populate processor on the right side use exactly this, it should output "23:40:16;00" (drop frame notation):

Code: Select all

$inttotc($jsonget('%s_info_mediainfo%',"media.track[1].Delay") * 29.97002997002997,29.97002997002997)
Explained - let's take it apart:
1) $jsonget('%s_info_mediainfo%',"media.track[1].Delay")
Gets the starttimecode that mediainfo reads as number. As the tc is written to bext chunk in 1 fps (i believe) (85215.931), at least that is how mediainfo presents the value in Delay property.

2) $inttotc($jsonget('%s_info_mediainfo%',"media.track[1].Delay") * 29.97002997002997,29.97002997002997)
inttotc function takes 2 arguments here (look for comma)).

First argument $jsonget('%s_info_mediainfo%',"media.track[1].Delay") * 29.97002997002997
is expected to be frames. But we only havetimcode independent of frames (e.g. 1 fps) in the mediainfo Delay value so we just multiply by the theoretical framerate. We use 29.97002997002997 to get as close as possible to the desired rate of 30000/1001.
We could also just set framerate 1: $inttotc($jsonget('%s_info_mediainfo%',"media.track[1].Delay") ,1), but bmxtimecode.exe (which is used behind inttotc function) in this case will output a non dropframe tc, because 1 fps does not need dropframe, so the tc would be 1 second off.

Second argument: 29.97002997002997
29.97002997002997, again the closest we get to the desired framerate 30000/1001. Possibly but did not test, we could also specify 30000/1001 instead of the float number. Another way would be to specify 29.97 in this second argument to $inttotc because the function would internally detect the odd framerate and replace it by 30000/1001. But i recommend to be always precise with numbers instead of relying on software to fix your sluggishness.

General note:
basically we talk about a BWAV here, it has additional metadata compared to normal wav called bext chunk.
fps in a wav and bwav file is a theoretical thing, i think it is accident (or timeline/project setting) that premiere uses 29.97 as default framerate for calculating the tc out of the wav file. I can't believe that the value "zSPEED" in the description is so much standardized that premiere uses it as calculation base.

Sidenote: if you must parse the framerate dynamically from the bext chunk, you best chance would be to do a regext function on the Description, e.g. $regext('%s_info_mediainfo%',"zSPEED=(.+?)D")
emcodem, wrapping since 2009 you got the rhyme?
andrezagato
Posts: 43
Joined: Tue Jun 09, 2020 4:07 pm

Re: Audio Wav with TC to audio mxf op-atom

Post by andrezagato »

Hey encodem. You blow my mind everytime! This is amazing!!!
Thanks so much for all the help you give! And the patience!

I tested and It worked perfectly...for a while... :(
I don't know exactly what happens, but the recording comes from different equipment, one of them works perfect! And the other is off by 1 frame.
I tried to find out what happened but no success..

this one is the one that works!

Code: Select all

 {
  "creatingLibrary": {
    "name": "MediaInfoLib",
    "version": "21.09",
    "url": "https://mediaarea.net/MediaInfo"
  },
  "media": {
    "@ref": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\AUDIO_BALADA\\RS3_BALADA_VITRINI_23_MAR\\D24_2403_RS3_BALADA_VITRINI_23_MAR_1_01_LEO_02_04_01_20_01.wav",
    "track": [
      {
        "@type": "General",
        "Count": "334",
        "StreamCount": "1",
        "StreamKind": "General",
        "StreamKind_String": "General",
        "StreamKindID": "0",
        "AudioCount": "1",
        "Audio_Format_List": "PCM",
        "Audio_Format_WithHint_List": "PCM",
        "Audio_Codec_List": "PCM",
        "CompleteName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\AUDIO_BALADA\\RS3_BALADA_VITRINI_23_MAR\\D24_2403_RS3_BALADA_VITRINI_23_MAR_1_01_LEO_02_04_01_20_01.wav",
        "FolderName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\AUDIO_BALADA\\RS3_BALADA_VITRINI_23_MAR",
        "FileNameExtension": "D24_2403_RS3_BALADA_VITRINI_23_MAR_1_01_LEO_02_04_01_20_01.wav",
        "FileName": "D24_2403_RS3_BALADA_VITRINI_23_MAR_1_01_LEO_02_04_01_20_01",
        "FileExtension": "wav",
        "Format": "Wave",
        "Format_String": "Wave",
        "Format_Extensions": "act at9 wav",
        "Format_Commercial": "Wave",
        "InternetMediaType": "audio/vnd.wave",
        "FileSize": "419715584",
        "FileSize_String": "400 MiB",
        "FileSize_String1": "400 MiB",
        "FileSize_String2": "400 MiB",
        "FileSize_String3": "400 MiB",
        "FileSize_String4": "400.3 MiB",
        "Duration": "2914.464",
        "Duration_String": "48 min 34 s",
        "Duration_String1": "48 min 34 s 464 ms",
        "Duration_String2": "48 min 34 s",
        "Duration_String3": "00:48:34.464",
        "Duration_String5": "00:48:34.464",
        "OverallBitRate_Mode": "CBR",
        "OverallBitRate_Mode_String": "Constant",
        "OverallBitRate": "1152090",
        "OverallBitRate_String": "1 152 kb/s",
        "StreamSize": "32768",
        "StreamSize_String": "32.0 KiB (0%)",
        "StreamSize_String1": "32 KiB",
        "StreamSize_String2": "32 KiB",
        "StreamSize_String3": "32.0 KiB",
        "StreamSize_String4": "32.00 KiB",
        "StreamSize_String5": "32.0 KiB (0%)",
        "StreamSize_Proportion": "0.00008",
        "Producer": "Boom Recorder v8.7.6+8.7.6",
        "Description": "bPROJECT=RS3_BALADA_VITRINI_23_MAR / bSCENE= / bTAKE=1 / bTAPE= / bTRK1=01 LEO / bSPEED=029.970-DF / bNOTE= / bFILENAME=RS3_BALADA_VITRINI_23_MAR_1_01_LEO_02_04_01_20_01.wav / bSLATE=",
        "Encoded_Date": "2023-03-24 02:04:06",
        "File_Created_Date": "UTC 2023-03-24 05:04:06.000",
        "File_Created_Date_Local": "2023-03-24 02:04:06.000",
        "File_Modified_Date": "UTC 2023-03-24 05:52:38.000",
        "File_Modified_Date_Local": "2023-03-24 02:52:38.000",
        "Encoded_Library_Settings": "A=PCM,F=48000,W=32,M=mono / A=PCM,F=48000,W=24,M=mono",
        "extra": {
          "bext_Present": "Yes",
          "bext_Version": "1",
          "Producer_Reference": "VOSBR800000202303240204060220000"
        }
      },
      {
        "@type": "Audio",
        "Count": "280",
        "StreamCount": "1",
        "StreamKind": "Audio",
        "StreamKind_String": "Audio",
        "StreamKindID": "0",
        "Format": "PCM",
        "Format_String": "PCM",
        "Format_Commercial": "PCM",
        "Format_Settings": "Little / Signed",
        "Format_Settings_Endianness": "Little",
        "Format_Settings_Sign": "Signed",
        "CodecID": "1",
        "CodecID_Url": "http://www.microsoft.com/windows/",
        "Duration": "2914.464",
        "Duration_String": "48 min 34 s",
        "Duration_String1": "48 min 34 s 464 ms",
        "Duration_String2": "48 min 34 s",
        "Duration_String3": "00:48:34.464",
        "Duration_String5": "00:48:34.464",
        "BitRate_Mode": "CBR",
        "BitRate_Mode_String": "Constant",
        "BitRate": "1152000",
        "BitRate_String": "1 152 kb/s",
        "Channels": "1",
        "Channels_String": "1 channel",
        "SamplingRate": "48000",
        "SamplingRate_String": "48.0 kHz",
        "SamplingCount": "139894272",
        "BitDepth": "24",
        "BitDepth_String": "24 bits",
        "Delay": "7441.667125000",
        "Delay_String": "2 h 4 min",
        "Delay_String1": "2 h 4 min 1 s 667 ms",
        "Delay_String2": "2 h 4 min",
        "Delay_String3": "02:04:01.667",
        "Delay_Source": "Container (bext)",
        "Delay_Source_String": "Container (bext)",
        "StreamSize": "419682816",
        "StreamSize_String": "400 MiB (100%)",
        "StreamSize_String1": "400 MiB",
        "StreamSize_String2": "400 MiB",
        "StreamSize_String3": "400 MiB",
        "StreamSize_String4": "400.2 MiB",
        "StreamSize_String5": "400 MiB (100%)",
        "StreamSize_Proportion": "0.99992"
      }
    ]
  }
}

this one all the files are off by 1 frame less

Code: Select all

 {
  "creatingLibrary": {
    "name": "MediaInfoLib",
    "version": "21.09",
    "url": "https://mediaarea.net/MediaInfo"
  },
  "media": {
    "@ref": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_B\\CARD_01\\B_RS03_BALADAVITRINI_230323_004.TAKE\\D24_2403_B_RS03_BALADAVITRINI_230323_004_TR1.WAV",
    "track": [
      {
        "@type": "General",
        "Count": "333",
        "StreamCount": "1",
        "StreamKind": "General",
        "StreamKind_String": "General",
        "StreamKindID": "0",
        "AudioCount": "1",
        "Audio_Format_List": "PCM",
        "Audio_Format_WithHint_List": "PCM",
        "Audio_Codec_List": "PCM",
        "CompleteName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_B\\CARD_01\\B_RS03_BALADAVITRINI_230323_004.TAKE\\D24_2403_B_RS03_BALADAVITRINI_230323_004_TR1.WAV",
        "FolderName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_B\\CARD_01\\B_RS03_BALADAVITRINI_230323_004.TAKE",
        "FileNameExtension": "D24_2403_B_RS03_BALADAVITRINI_230323_004_TR1.WAV",
        "FileName": "D24_2403_B_RS03_BALADAVITRINI_230323_004_TR1",
        "FileExtension": "WAV",
        "Format": "Wave",
        "Format_String": "Wave",
        "Format_Extensions": "act at9 wav",
        "Format_Commercial": "Wave",
        "InternetMediaType": "audio/vnd.wave",
        "FileSize": "203172308",
        "FileSize_String": "194 MiB",
        "FileSize_String1": "194 MiB",
        "FileSize_String2": "194 MiB",
        "FileSize_String3": "194 MiB",
        "FileSize_String4": "193.8 MiB",
        "Duration": "1410.009",
        "Duration_String": "23 min 30 s",
        "Duration_String1": "23 min 30 s 9 ms",
        "Duration_String2": "23 min 30 s",
        "Duration_String3": "00:23:30.009",
        "Duration_String5": "00:23:30.009",
        "OverallBitRate_Mode": "CBR",
        "OverallBitRate_Mode_String": "Constant",
        "OverallBitRate": "1152743",
        "OverallBitRate_String": "1 153 kb/s",
        "StreamSize": "131072",
        "StreamSize_String": "128 KiB (0%)",
        "StreamSize_String1": "128 KiB",
        "StreamSize_String2": "128 KiB",
        "StreamSize_String3": "128 KiB",
        "StreamSize_String4": "128.0 KiB",
        "StreamSize_String5": "128 KiB (0%)",
        "StreamSize_Proportion": "0.00065",
        "Producer": "ZOOM F8",
        "Description": "zSPEED=29.970D / zTAKE=004 / zUBITS=00000000 / zSCENE=B_RS03_BAL / zTAPE= / zCIRCLED=FALSE / zTRK3=NOVINH / zTRK4=TRIS / zTRK5=RICK / zTRK6=MISSI / zTRK7=THIAGO / zTRK8=JESSIC / zNOTE=",
        "Encoded_Date": "2023-03-24 03:07:34",
        "File_Created_Date": "UTC 2023-03-24 06:07:34.000",
        "File_Created_Date_Local": "2023-03-24 03:07:34.000",
        "File_Modified_Date": "UTC 2023-03-24 06:31:04.000",
        "File_Modified_Date_Local": "2023-03-24 03:31:04.000",
        "Encoded_Library_Settings": "A=PCM,F=48000,W=24,M=mono,T=F8;VERSION=1.10;1:1 0 0 CNTR + 15;2:1 0 0 CNTR + 05;3:1 0 0 CNTR + 15;4:1 0 0 CNTR + 10;5:1 0 0 CNTR + 10;6:1 0 0 CNTR + 10;7:0 0 0 CNTR + 90;8:0 0 0 CNTR   00;L:0 1 0 CNTR - 60;R:0 1 0 CNTR - 60;FaderOffset=  00   00   00   00   00   00   00   00;",
        "extra": {
          "bext_Present": "Yes",
          "bext_Version": "1"
        }
      },
      {
        "@type": "Audio",
        "Count": "280",
        "StreamCount": "1",
        "StreamKind": "Audio",
        "StreamKind_String": "Audio",
        "StreamKindID": "0",
        "Format": "PCM",
        "Format_String": "PCM",
        "Format_Commercial": "PCM",
        "Format_Settings": "Little / Signed",
        "Format_Settings_Endianness": "Little",
        "Format_Settings_Sign": "Signed",
        "CodecID": "1",
        "CodecID_Url": "http://www.microsoft.com/windows/",
        "Duration": "1410.009",
        "Duration_String": "23 min 30 s",
        "Duration_String1": "23 min 30 s 9 ms",
        "Duration_String2": "23 min 30 s",
        "Duration_String3": "00:23:30.009",
        "Duration_String5": "00:23:30.009",
        "BitRate_Mode": "CBR",
        "BitRate_Mode_String": "Constant",
        "BitRate": "1152000",
        "BitRate_String": "1 152 kb/s",
        "Channels": "1",
        "Channels_String": "1 channel",
        "SamplingRate": "48000",
        "SamplingRate_String": "48.0 kHz",
        "SamplingCount": "67680412",
        "BitDepth": "24",
        "BitDepth_String": "24 bits",
        "Delay": "11278.000",
        "Delay_String": "3 h 7 min",
        "Delay_String1": "3 h 7 min 58 s 0 ms",
        "Delay_String2": "3 h 7 min",
        "Delay_String3": "03:07:58.000",
        "Delay_Source": "Container (bext)",
        "Delay_Source_String": "Container (bext)",
        "StreamSize": "203041236",
        "StreamSize_String": "194 MiB (100%)",
        "StreamSize_String1": "194 MiB",
        "StreamSize_String2": "194 MiB",
        "StreamSize_String3": "194 MiB",
        "StreamSize_String4": "193.6 MiB",
        "StreamSize_String5": "194 MiB (100%)",
        "StreamSize_Proportion": "0.99935"
      }
    ]
  }
}

any input would be appreciated!
thanks
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Audio Wav with TC to audio mxf op-atom

Post by emcodem »

Yeah, sorry i dont have much experience with ntsc timecode calculations.
OK so it looks like the first calculation we do, multiply the Delay by Framerate always outputs a number that is either slightly above or slightly under an integer (full) number. But of course for calculating a SMPTE TC from number of frames, we need a full number of frames (0.3 frames cannot be expressed in timecode)
So for the 2 values we have as example it is like:

Calculate from bext native TC (mediainfo delay) to NTSC Based TC in number of frames:
Working example:
Delay: 85215.931
Calculation: 85215.931 * 30000 / 1001 = 2553924,005994006
The number we want is 2553924 (rounded down)

Non Working example:
"Delay": "11278.000",
Calculation: 11278 * 30000 / 1001 = 338001,998001998
The number we want is 338002 (rounded up)

So in our "working example" we are 0.005 frames above a full frame number and in the non working one, we are 0.002 frames below a full frames number.
So after all it looks like for the final result we have to add some rounding. Fortunately there is an inbuilt function for that in ffastrans called $round which we can just add inline to our existing functions from before:

Code: Select all

$inttotc($round($jsonget('%s_info_mediainfo%',"media.track[1].Delay") * 30000/1001),30000/1001)
note that i changed everything to 30000/1001, it can always be replaced by 29.97002997002997 but i found it easier to read that way.

Of course, for better readability and option to debug/log the numbers easily, you could also do every function as a separate step in a populate processor, e.g.
%f_starttc_bwav% = $jsonget('%s_info_mediainfo%',"media.track[1].Delay")
%f_starttc_in_frames% = $round(%s_starttc_bwav% * 30000/1001)
%s_starttc_smpte% = $inttotc (%f_starttc_in_frames%, 30000/1001)
emcodem, wrapping since 2009 you got the rhyme?
andrezagato
Posts: 43
Joined: Tue Jun 09, 2020 4:07 pm

Re: Audio Wav with TC to audio mxf op-atom

Post by andrezagato »

Hey emcodem,
I want to give you an update.
First of all, it worked, but again. "partially". So I've made a sheet comparing what Davinci showed as TC, and compared with the round(), roundu() and roundd().

After a while I saw a pattern, I have 2 different recorders, and I don't know why, but for the first recorder, the round() function worked perfectly. But for the second recorder, the TC matched only with the roundd() function.

I got it working using some conditionals to differ one from the other and apply the correct round function. So it is all good!
But if you are curious, here are some sample mediainfo from each recorder.

This one the roundd() worked. - rounddown

Code: Select all

 {
  "creatingLibrary": {
    "name": "MediaInfoLib",
    "version": "21.09",
    "url": "https://mediaarea.net/MediaInfo"
  },
  "media": {
    "@ref": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\SWITCHER\\RIOSHORE3_24_MANHA_02\\D24_2403_RS3_MANHA02_03_NOVINHO_12_11_56_29_03.wav",
    "track": [
      {
        "@type": "General",
        "Count": "334",
        "StreamCount": "1",
        "StreamKind": "General",
        "StreamKind_String": "General",
        "StreamKindID": "0",
        "AudioCount": "1",
        "Audio_Format_List": "PCM",
        "Audio_Format_WithHint_List": "PCM",
        "Audio_Codec_List": "PCM",
        "CompleteName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\SWITCHER\\RIOSHORE3_24_MANHA_02\\D24_2403_RS3_MANHA02_03_NOVINHO_12_11_56_29_03.wav",
        "FolderName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\SWITCHER\\RIOSHORE3_24_MANHA_02",
        "FileNameExtension": "D24_2403_RS3_MANHA02_03_NOVINHO_12_11_56_29_03.wav",
        "FileName": "D24_2403_RS3_MANHA02_03_NOVINHO_12_11_56_29_03",
        "FileExtension": "wav",
        "Format": "Wave",
        "Format_String": "Wave",
        "Format_Extensions": "act at9 wav",
        "Format_Commercial": "Wave",
        "InternetMediaType": "audio/vnd.wave",
        "FileSize": "8674304",
        "FileSize_String": "8.27 MiB",
        "FileSize_String1": "8 MiB",
        "FileSize_String2": "8.3 MiB",
        "FileSize_String3": "8.27 MiB",
        "FileSize_String4": "8.272 MiB",
        "Duration": "65.318",
        "Duration_String": "1 min 5 s",
        "Duration_String1": "1 min 5 s 318 ms",
        "Duration_String2": "1 min 5 s",
        "Duration_String3": "00:01:05.318",
        "Duration_String5": "00:01:05.318",
        "OverallBitRate_Mode": "CBR",
        "OverallBitRate_Mode_String": "Constant",
        "OverallBitRate": "1062409",
        "OverallBitRate_String": "1 062 kb/s",
        "StreamSize": "32768",
        "StreamSize_String": "32.0 KiB (0%)",
        "StreamSize_String1": "32 KiB",
        "StreamSize_String2": "32 KiB",
        "StreamSize_String3": "32.0 KiB",
        "StreamSize_String4": "32.00 KiB",
        "StreamSize_String5": "32.0 KiB (0%)",
        "StreamSize_Proportion": "0.00378",
        "Producer": "Boom Recorder v8.7.2+8.7.2",
        "Description": "bPROJECT=RIOSHORE3_24_MAR_MANHA_02 / bSCENE= / bTAKE=107 / bTAPE= / bTRK3=03 NOVINHO / bSPEED=029.970-DF / bNOTE= / bFILENAME=RIOSHORE3_24_MANHA_02_03_NOVINHO_12_11_56_29_03.wav / bSLATE=",
        "Encoded_Date": "2023-03-24 12:11:44",
        "File_Created_Date": "UTC 2023-03-24 15:11:45.000",
        "File_Created_Date_Local": "2023-03-24 12:11:45.000",
        "File_Modified_Date": "UTC 2023-03-24 15:12:44.000",
        "File_Modified_Date_Local": "2023-03-24 12:12:44.000",
        "Encoded_Library_Settings": "A=PCM,F=44100,W=32,M=mono / A=PCM,F=44100,W=24,M=mono",
        "extra": {
          "bext_Present": "Yes",
          "bext_Version": "1",
          "Producer_Reference": "VOSBR800000202303241211447000000"
        }
      },
      {
        "@type": "Audio",
        "Count": "280",
        "StreamCount": "1",
        "StreamKind": "Audio",
        "StreamKind_String": "Audio",
        "StreamKindID": "0",
        "Format": "PCM",
        "Format_String": "PCM",
        "Format_Commercial": "PCM",
        "Format_Settings": "Little / Signed",
        "Format_Settings_Endianness": "Little",
        "Format_Settings_Sign": "Signed",
        "CodecID": "1",
        "CodecID_Url": "http://www.microsoft.com/windows/",
        "Duration": "65.318",
        "Duration_String": "1 min 5 s",
        "Duration_String1": "1 min 5 s 318 ms",
        "Duration_String2": "1 min 5 s",
        "Duration_String3": "00:01:05.318",
        "Duration_String5": "00:01:05.318",
        "BitRate_Mode": "CBR",
        "BitRate_Mode_String": "Constant",
        "BitRate": "1058400",
        "BitRate_String": "1 058 kb/s",
        "Channels": "1",
        "Channels_String": "1 channel",
        "SamplingRate": "44100",
        "SamplingRate_String": "44.1 kHz",
        "SamplingCount": "2880512",
        "BitDepth": "24",
        "BitDepth_String": "24 bits",
        "Delay": "43917.000000000",
        "Delay_String": "12 h 11 min",
        "Delay_String1": "12 h 11 min 57 s 0 ms",
        "Delay_String2": "12 h 11 min",
        "Delay_String3": "12:11:57.000",
        "Delay_Source": "Container (bext)",
        "Delay_Source_String": "Container (bext)",
        "StreamSize": "8641536",
        "StreamSize_String": "8.24 MiB (100%)",
        "StreamSize_String1": "8 MiB",
        "StreamSize_String2": "8.2 MiB",
        "StreamSize_String3": "8.24 MiB",
        "StreamSize_String4": "8.241 MiB",
        "StreamSize_String5": "8.24 MiB (100%)",
        "StreamSize_Proportion": "0.99622"
      }
    ]
  }
}

This one the round() worked

Code: Select all

 {
  "creatingLibrary": {
    "name": "MediaInfoLib",
    "version": "21.09",
    "url": "https://mediaarea.net/MediaInfo"
  },
  "media": {
    "@ref": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_A\\CARD_02\\A_RS03_MANDARIN_COM_JOJO_240323_001.TAKE\\D24_2403_A_RS03_MANDARIN_COM_JOJO_240323_001_TR1.WAV",
    "track": [
      {
        "@type": "General",
        "Count": "333",
        "StreamCount": "1",
        "StreamKind": "General",
        "StreamKind_String": "General",
        "StreamKindID": "0",
        "AudioCount": "1",
        "Audio_Format_List": "PCM",
        "Audio_Format_WithHint_List": "PCM",
        "Audio_Codec_List": "PCM",
        "CompleteName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_A\\CARD_02\\A_RS03_MANDARIN_COM_JOJO_240323_001.TAKE\\D24_2403_A_RS03_MANDARIN_COM_JOJO_240323_001_TR1.WAV",
        "FolderName": "\\\\192.168.10.21\\rs3_bruto3\\BRUTO\\D24_2403\\SSD01\\RS3\\D24_2403\\AUDIO\\MESA_A\\CARD_02\\A_RS03_MANDARIN_COM_JOJO_240323_001.TAKE",
        "FileNameExtension": "D24_2403_A_RS03_MANDARIN_COM_JOJO_240323_001_TR1.WAV",
        "FileName": "D24_2403_A_RS03_MANDARIN_COM_JOJO_240323_001_TR1",
        "FileExtension": "WAV",
        "Format": "Wave",
        "Format_String": "Wave",
        "Format_Extensions": "act at9 wav",
        "Format_Commercial": "Wave",
        "InternetMediaType": "audio/vnd.wave",
        "FileSize": "447102398",
        "FileSize_String": "426 MiB",
        "FileSize_String1": "426 MiB",
        "FileSize_String2": "426 MiB",
        "FileSize_String3": "426 MiB",
        "FileSize_String4": "426.4 MiB",
        "Duration": "3103.968",
        "Duration_String": "51 min 43 s",
        "Duration_String1": "51 min 43 s 968 ms",
        "Duration_String2": "51 min 43 s",
        "Duration_String3": "00:51:43.968",
        "Duration_String5": "00:51:43.968",
        "OverallBitRate_Mode": "CBR",
        "OverallBitRate_Mode_String": "Constant",
        "OverallBitRate": "1152338",
        "OverallBitRate_String": "1 152 kb/s",
        "StreamSize": "131072",
        "StreamSize_String": "128 KiB (0%)",
        "StreamSize_String1": "128 KiB",
        "StreamSize_String2": "128 KiB",
        "StreamSize_String3": "128 KiB",
        "StreamSize_String4": "128.0 KiB",
        "StreamSize_String5": "128 KiB (0%)",
        "StreamSize_Proportion": "0.00029",
        "Producer": "ZOOM F8",
        "Description": "zSPEED=29.970D / zTAKE=001 / zUBITS=00000000 / zSCENE=A_RS03_MAN / zTAPE= / zCIRCLED=FALSE / zTRK3=MISSIS / zTRK4=WILL / zTRK5=NOVINH / zTRK6=JESSIC / zTRK7=TRIS / zTRK8=TIAGO / zNOTE=X",
        "Encoded_Date": "2023-03-24 20:42:11",
        "File_Created_Date": "UTC 2023-03-24 23:42:11.000",
        "File_Created_Date_Local": "2023-03-24 20:42:11.000",
        "File_Modified_Date": "UTC 2023-03-25 00:33:56.000",
        "File_Modified_Date_Local": "2023-03-24 21:33:56.000",
        "Encoded_Library_Settings": "A=PCM,F=48000,W=24,M=mono,T=F8;VERSION=1.10;1:1 0 0 CNTR   00;2:1 0 0 CNTR   00;3:1 0 0 CNTR + 05;4:1 0 0 CNTR - 05;5:1 0 0 CNTR   00;6:1 0 0 CNTR + 05;7:0 0 0 CNTR MUTE;8:0 0 0 CNTR -120;L:0 1 0 CNTR   00;R:0 1 0 CNTR   00;FaderOffset=  00   00   00   00   00   00   00   00;",
        "extra": {
          "bext_Present": "Yes",
          "bext_Version": "1"
        }
      },
      {
        "@type": "Audio",
        "Count": "280",
        "StreamCount": "1",
        "StreamKind": "Audio",
        "StreamKind_String": "Audio",
        "StreamKindID": "0",
        "Format": "PCM",
        "Format_String": "PCM",
        "Format_Commercial": "PCM",
        "Format_Settings": "Little / Signed",
        "Format_Settings_Endianness": "Little",
        "Format_Settings_Sign": "Signed",
        "CodecID": "1",
        "CodecID_Url": "http://www.microsoft.com/windows/",
        "Duration": "3103.968",
        "Duration_String": "51 min 43 s",
        "Duration_String1": "51 min 43 s 968 ms",
        "Duration_String2": "51 min 43 s",
        "Duration_String3": "00:51:43.968",
        "Duration_String5": "00:51:43.968",
        "BitRate_Mode": "CBR",
        "BitRate_Mode_String": "Constant",
        "BitRate": "1152000",
        "BitRate_String": "1 152 kb/s",
        "Channels": "1",
        "Channels_String": "1 channel",
        "SamplingRate": "48000",
        "SamplingRate_String": "48.0 kHz",
        "SamplingCount": "148990442",
        "BitDepth": "24",
        "BitDepth_String": "24 bits",
        "Delay": "74545.938",
        "Delay_String": "20 h 42 min",
        "Delay_String1": "20 h 42 min 25 s 938 ms",
        "Delay_String2": "20 h 42 min",
        "Delay_String3": "20:42:25.938",
        "Delay_Source": "Container (bext)",
        "Delay_Source_String": "Container (bext)",
        "StreamSize": "446971326",
        "StreamSize_String": "426 MiB (100%)",
        "StreamSize_String1": "426 MiB",
        "StreamSize_String2": "426 MiB",
        "StreamSize_String3": "426 MiB",
        "StreamSize_String4": "426.3 MiB",
        "StreamSize_String5": "426 MiB (100%)",
        "StreamSize_Proportion": "0.99971"
      }
    ]
  }
}
Thanks so much for your help!
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Audio Wav with TC to audio mxf op-atom

Post by emcodem »

Hm not sure if "all" timecodes will be calculated correctly this way.
The problem in the stuff that works with roundd is that Delay in Mediainfo is presented as:
43917.000000000 - this leads to a calculated value of 1316193,806

The other one is much more precise:
74545.938 - calculated: 2234143996,003

Honestly i feel well with rounding 0.003 but i would not have expected that we need to round from a value like 0.8 (especiall not round DOWN)

Ok so what could be the problem source?
To get that out, either you send me some files or i recommend to also take the raw timecode value that is written in the bext chunk into consideration. One tool that can display this is (look at "Core/Timereference"):
https://mediaarea.net/BWFMetaEdit

Mediainfo itself does not show the raw value but it shows a calculated value that seems to take "Samplerate" into account. Also it does lots of magic between the actual calculation of the value and the final "display" of the value.
Looking at the samplerate, the problematic file is 44100 and the working one is 48000. Maybe there is a calculation error in mediainfo?
What did we overlook here?

Also, i have seen in a abother version of mediainfo than the one that we ship with ffastrans, the commas of the bext delay are shifted by factor 1000, so there has some work been done in that area. Maybe you compare the values from ffastrans with a recent version of mediainfo too? Or compare the values to the output of exiftool (if it supports BEXT chunk)?

The
emcodem, wrapping since 2009 you got the rhyme?
andrezagato
Posts: 43
Joined: Tue Jun 09, 2020 4:07 pm

Re: Audio Wav with TC to audio mxf op-atom

Post by andrezagato »

I will look more with this tool you sent.
Also I DM you with a few files if you want to dig a little bit deeper!

Thanks
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Audio Wav with TC to audio mxf op-atom

Post by emcodem »

OK i believe i found something. Looking at the file you sent with smallest TC, we have the following values:
Mediainfo Delay: 573973 (without commas)
Original TimeReference from bext chunk: 27550724
SamplesPerSec: 48000

What mediainfo does to come from bext Timeref to it's Delay is to use this formula:
TimeReference*1000/SamplesPerSec

So let's check if Mediainfo Displays the correct value:
TimeReference*1000/SamplesPerSec = MediainfoDelay
27550724 * 1000 / 48000 = 573973,4166666667

This is the same valur as mediainfo delay shows but with a few numbers after comma!

If i am correct here, we can round as much as we want but never get it right because there is a bug in mediainfo hiding the real base numbers from us.
So mediainfo Delay value is missing everything after the comma actually. I checked the source code but found no obvious like rounding or casting issue, also i cannot explain why sometimes the mediainfo delay has commas and other times not.

Anyway, looks like we must turn away from mediainfo and just use the real TimeReference value from Bext chunk instead (which is preferred anyways, i always prefer RAW values over interpreted ones)

We take the same calculations as before but repalce mediainfo delay by (TimeReference*1000/SamplesPerSec) - and take the timereference from exiftool. Fortunately ffastrans already has it, so it stays a single line in populate processor:

Code: Select all

$inttotc($jsonget("%s_info_exiftool%","[0].TimeReference") / %i_a_sample_rate%  * 30000 / 1001 , 30000 / 1001 )
Please try and let me know :D
emcodem, wrapping since 2009 you got the rhyme?
andrezagato
Posts: 43
Joined: Tue Jun 09, 2020 4:07 pm

Re: Audio Wav with TC to audio mxf op-atom

Post by andrezagato »

Hello Emcodem!
I've been using it and it is working very well!

Thanks so much for the help! you are awesome!
Post Reply