Closed schjonhaug closed 5 years ago
Audio files can be created using a start timecode. This should be extracted from the audio file and the audio player and results start times offset accordinly.
Using the command
ffprobe -print_format json -show_streams -show_format JULEMKAMB0052_med_TC.wav
yields
ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers built with Apple LLVM version 10.0.0 (clang-1000.11.45.5) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 { Input #0, wav, from 'JULEMKAMB0052_med_TC.wav': Metadata: encoded_by : Adobe Premiere Pro CC 2018.1 (Wi date : 2019-01-07 creation_time : 09:08:04 time_reference : 1792416000 Duration: 00:00:22.12, bitrate: 1540 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s "streams": [ { "index": 0, "codec_name": "pcm_s16le", "codec_long_name": "PCM signed 16-bit little-endian", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "[1][0][0][0]", "codec_tag": "0x0001", "sample_fmt": "s16", "sample_rate": "48000", "channels": 2, "bits_per_sample": 16, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/48000", "duration_ts": 1061760, "duration": "22.120000", "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 } } ], "format": { "filename": "JULEMKAMB0052_med_TC.wav", "nb_streams": 1, "nb_programs": 0, "format_name": "wav", "format_long_name": "WAV / WAVE (Waveform Audio)", "duration": "22.120000", "size": "4259344", "bit_rate": "1540449", "probe_score": 99, "tags": { "encoded_by": "Adobe Premiere Pro CC 2018.1 (Wi", "date": "2019-01-07", "creation_time": "09:08:04", "time_reference": "1792416000" } } }
To calculate the start timecode, we need to divide the time_reference by sample_rate to get seconds since midnight: 1792416000/48000 = 10:22:22:00.
time_reference
sample_rate
1792416000/48000
10:22:22:00
Check to see if https://github.com/CrystalComputerCorp/smpte-timecode can help with the conversion. Alternatively check if MediaInfo or ExifTool can be used.
Should be possible to use with https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#reading-video-metadata
Audio files can be created using a start timecode. This should be extracted from the audio file and the audio player and results start times offset accordinly.
Using the command
yields
To calculate the start timecode, we need to divide the
time_reference
bysample_rate
to get seconds since midnight:1792416000/48000
=10:22:22:00
.Check to see if https://github.com/CrystalComputerCorp/smpte-timecode can help with the conversion. Alternatively check if MediaInfo or ExifTool can be used.
Should be possible to use with https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#reading-video-metadata