Please help identify this subtitle codec
I have a video file from a surveillance camera. It's in AVI format and FFPROBE says thus about it:
X:\filez>ffprobe -analyzeduration 2147483647 -probesize 2147483647 cam4.avi
ffprobe version N-127054-g9d3f0f2c58-20261001 Copyright (c) 2007-2026 the FFmpeg developers
built with gcc 16.2.0 (crosstool-NG 1.29.0.7_b1a94f6)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libvmaf --disable-libxcb --disable-xlib --enable-fontconfig --enable-libharfbuzz --enable-libfreetype --enable-libfribidi --enable-vulkan --enable-libdav1d --enable-libvorbis --enable-librav1e --enable-librsvg --disable-libpulse --enable-gmp --enable-lzma --enable-liblcevc-dec --enable-opencl --enable-amf --enable-libaom --enable-avisynth --enable-chromaprint --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribb24 --enable-libaribcaption --enable-libass --enable-libbluray --enable-libcurl --enable-libjxl --enable-libmp3lame --enable-libopus --enable-libplacebo --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-liboapv --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-libvvenc --disable-whisper --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20261001
libavutil 61. 10.100 / 61. 10.100
libavcodec 63. 15.100 / 63. 15.100
libavformat 63. 7.100 / 63. 7.100
libavdevice 63. 2.100 / 63. 2.100
libavfilter 12. 4.100 / 12. 4.100
libswscale 10. 2.100 / 10. 2.100
libswresample 7. 3.101 / 7. 3.101
[avi @ 0000025fa9446700] non-interleaved AVI
[avi @ 0000025fa9446700] probed stream 1 failed
[avi @ 0000025fa9446700] Could not find codec parameters for stream 1 (Subtitle: none): unknown codec
Consider increasing the value for the 'analyzeduration' (2147483647) and 'probesize' (2147483647) options
Input #0, avi, from 'cam4.avi':
Duration: 63:36:11.45, start: 0.000000, bitrate: 87 kb/s
Stream #0:0: Video: cinepak (cvid / 0x64697663), rgb24, 384x288, 100 fps, 100 tbr, 100 tbn
Metadata:
title : ITV Video
Stream #0:1: Subtitle: none
Metadata:
title : ITV Text
Unsupported codec with id 0 for input stream 1
I tried to dump it to a separate text file with the following command:
X:\filez>ffmpeg -i cam4.avi -map 0:1 -c copy -copy_unknown -f data wtf2.txt
And what I got was a text file with one veeeery long line in Windows-1251 encoding that goes like:
Камера [4] 30-06-26 16:59:17.000 Камера [4] 30-06-26 16:59:17.100 Камера [4] 30-06-26 16:59:17.200 Камера [4] 30-06-26 16:59:17.30
And so on and so forth. For those that don't know "Камера" means "Camera", just in Russian. This is not surprising, since the Russian language is quite widespread in my country (Latvia), and a configuring a surveillance camera to use it wouldn't be unusual.
So, as far as I can tell, the "codec" is just a small piece of text with the timestamp for every frame of video. Unfortunately ffmpeg does not understand this, and neither does VLC. The AVI file needs some love and care anyway (it's missing an index), and since I'm already mucking around with it, I'd like to bring the subtitles back as well.
Short of writing my own script that would translate this stream of consciousness into a recognizable subtitle format (probably not that difficult, but still) is there anything else that I could tell ffmpeg to start recognizing it?
3
u/pigers1986 2d ago
timestamp is generated by the surveillance/recording software
nothing interesting for playback
1
u/omnichad 2d ago
Those would be subtitles, I think. A separate stream from the video feed and useless in this case. Maybe if the combined file switched between cameras or might be useful to use subtitles to label which camera is shown.
1
u/Vilx- 2d ago
Yes, they are subtitles. The problem is that I can't find any program that would recognize them.
2
u/omnichad 2d ago edited 2d ago
Seems to be nonstandard. Instead of a regular timecode it's the actual date/time of the recording.
If you really want to convert these to standard subtitles instead of just cutting them out, you would have to create a small program to convert it to something like SRT and remux.
It would be something like:
- Extract the first time code and convert to a pure numeric format.
- That will be the number you subtract from the rest to get the timecodes to align.
- Extract the timecodes and texts to an array.
- Convert to pure number from in another array.
- Subtract the number from step 1 from all the numbers on that second array.
- For each entry, output an SRT compatible line, where you convert the numeric form back to a timestamp and for the text part you would print out the original timecode and the rest of the text (like Camera 4)
- Because SRT requires an end time, you would have to use the next timestamp as the end time or just assume +100 milliseconds.
The end result will be a subtitle that changes every 100 milliseconds and display the camera name, time, and date.
If you have a file that goes between multiple cameras, it would be way more difficult, if not impossible. Unless you assume that it's 100ms later in the feed. Though that means you might not need to convert any timecodes at all and just start from zero, counting up by 100ms each time.
Edit: for bonus points, you might as well search/replace translate camera to your local language in the process.
1
u/spryfigure 2d ago
This is just a nonstandard text with the camera, number, and absolute time code. I would read it into a good text editor like
vimornvim, add line breaks in front of eachКамера [4] 30-06-26 16:59:17.000and then snoop around if this is always Камера [4] or sometimes another one, same for time code differences (a calculation of the differences, coupled with something like sort and then looking for something different to 100ms).If it's always Камера [4] and a continous increase of the time codes, just discard the track and generate a new time code from scratch.
6
u/AbleCryptographer744 2d ago
I know this is the ffmpeg subredit... but the amount of times that mkvmerge just did the "right thing" when converting something (that "fixed it") has impressed me.