pdeljanov / Symphonia

Pure Rust multimedia format demuxing, tag reading, and audio decoding library
Mozilla Public License 2.0
2.29k stars 135 forks source link

Should bwfxml metadata appear when getting metadata? #195

Open ChristopherBiscardi opened 1 year ago

ChristopherBiscardi commented 1 year ago

Hiya. I have a .wav file that came from a zoom f3 recorder with timecode and I'm not finding some data I expect to see when processing the audio.

I am unable to see the timecode in the symphonia produced metadata (I can see other metadata).

I haven't gotten too deep into investigating the metadata parsing in symphonia, but I've confirmed that there is a BWFXML section at the head of the file.

Is this something symphonia should be able to parse and display in metadata? In this case I can see the number I need in TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO.

RIFF��,WAVEbextZzSPEED=25.000ND
zTAKE=001
zUBITS=00000000
zSCENE=230308
zTAPE=
zCIRCLED=FALSE
zTRK4=Tr2
zNOTE=
ZOOM F32023-03-0817:11:08�>�A=PCM,F=48000,W=32,M=mono,T=F3;VERSION=1.10;P=230308_001_Tr1;iXMLj<?xml version="1.0" encoding="UTF-8"?>
<BWFXML>
    <IXML_VERSION>1.62</IXML_VERSION>
    <PROJECT></PROJECT>
    <SCENE>230308</SCENE>
    <TAKE>001</TAKE>
    <TAPE></TAPE>
    <CIRCLED>FALSE</CIRCLED>
    <FILE_UID>ZOOM F3    202303081711080080002</FILE_UID>
    <UBITS>00000000</UBITS>
    <NOTE></NOTE>
    <SPEED>
        <NOTE></NOTE>
        <MASTER_SPEED>25/1</MASTER_SPEED>
        <CURRENT_SPEED>25/1</CURRENT_SPEED>
        <TIMECODE_RATE>25/1</TIMECODE_RATE>
        <TIMECODE_FLAG>NDF</TIMECODE_FLAG>
        <FILE_SAMPLE_RATE>48000</FILE_SAMPLE_RATE>
        <AUDIO_BIT_DEPTH>32</AUDIO_BIT_DEPTH>
        <DIGITIZER_SAMPLE_RATE>48000</DIGITIZER_SAMPLE_RATE>
        <TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI>0000000000</TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI>
        <TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO>0032784000</TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO>
        <TIMESTAMP_SAMPLE_RATE>48000</TIMESTAMP_SAMPLE_RATE>
    </SPEED>
    <HISTORY>
        <ORIGINAL_FILENAME>230308_001_Tr2.WAV</ORIGINAL_FILENAME>
    </HISTORY>
    <FILE_SET>
        <TOTAL_FILES>1</TOTAL_FILES>
        <FAMILY_UID>ZOOM F3    202303081711080080000</FAMILY_UID>
        <FILE_SET_INDEX>1</FILE_SET_INDEX>
    </FILE_SET>
    <TRACK_LIST>
        <TRACK_COUNT>1</TRACK_COUNT>
        <TRACK>
            <CHANNEL_INDEX>4</CHANNEL_INDEX>
            <INTERLEAVE_INDEX>1</INTERLEAVE_INDEX>
            <NAME></NAME>
        </TRACK>
    </TRACK_LIST>
</BWFXML>
ffprobe *does* find this data, with the relevant data I'm looking for in `tags.time_reference` ``` ❯ ffprobe -i /Users/chris/230308_001_Tr2.WAV -v quiet -print_format json -show_format -show_streams { "streams": [ { "index": 0, "codec_name": "pcm_f32le", "codec_long_name": "PCM 32-bit floating point little-endian", "codec_type": "audio", "codec_tag_string": "[3][0][0][0]", "codec_tag": "0x0003", "sample_fmt": "flt", "sample_rate": "48000", "channels": 1, "bits_per_sample": 32, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/48000", "duration_ts": 4800000, "duration": "100.000000", "bit_rate": "1536000", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 } } ], "format": { "filename": "/Users/chris/2023-03-08-timecode-recording/230308_001_Tr2.WAV", "nb_streams": 1, "nb_programs": 0, "format_name": "wav", "format_long_name": "WAV / WAVE (Waveform Audio)", "duration": "100.000000", "size": "19724288", "bit_rate": "1577943", "probe_score": 99, "tags": { "comment": "zSPEED=25.000ND\r\nzTAKE=001\r\nzUBITS=00000000\r\nzSCENE=230308\r\nzTAPE=\r\nzCIRCLED=FALSE\r\nzTRK4=Tr2\r\nzNOTE=\r\n", "encoded_by": "ZOOM F3", "date": "2023-03-08", "creation_time": "17:11:08", "time_reference": "32784000", "coding_history": "A=PCM,F=48000,W=32,M=mono,T=F3;VERSION=1.10;P=" } } } ```
All I can see is the track information and empty metadata revisions ``` [src/main.rs:53] v = Track { id: 0, codec_params: CodecParameters { codec: CodecType( 284, ), sample_rate: Some( 48000, ), time_base: Some( TimeBase { numer: 1, denom: 48000, }, ), n_frames: Some( 4800000, ), start_ts: 0, sample_format: None, bits_per_sample: None, bits_per_coded_sample: None, channels: Some( FRONT_LEFT, ), channel_layout: None, delay: None, padding: None, max_frames_per_packet: Some( 1152, ), packet_data_integrity: false, verification_check: None, frames_per_block: Some( 1, ), extra_data: None, }, language: None, } [src/main.rs:94] format.metadata() = Metadata { revisions: [], } ```
ChristopherBiscardi commented 1 year ago

I later found some debug logs and confirmed that the relevant chunks don't currently get parsed.

The latter (iXML/bwfxml) would require an xml parser to be added as far as I can tell.

symphonia_format_wav::chunks: ignoring unknown chunk: tag=bext, len=1114.
symphonia_format_wav::chunks: ignoring unknown chunk: tag=iXML, len=5226.