We have a .ts
input file that contains (among other streams) a video stream and MISB 0604-compliant KLV data stream. The output of ffprobe
for these stream are:
Stream #0:0[0x111]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
...
Stream #0:2[0x1001]: Data: klv (KLVA / 0x41564C4B)
We are hoping to extract every Nth frame of the video as a .tiff
. We also need to associate each of these frames with a corresponding KLV packet from the MISB 0604-compliant data stream.
The following command that select filters and adjusts the original FPS by the corresponding ratio does result in the expected frames being saved out as TIFF (in this case the original video has 1187 frames, and I expect to get 12 frames from the select filter).
ffmpeg -y -i 2205Z.ts -map 0:0 -vf "select='not(mod(n,100))'",fps=30000/1001/100 -compression_algo raw -pix_fmt rgb24 %05d.tif
However I can't seem to get any filters working on the data stream. For example using filter:d
does not throw an error, but also doesn't seem to actually filter. My question is whether ffmpeg
can be used to save out a "downsampled" data stream corresponding to the downsampling operations performed on the video stream above?
Using a recent git master build, run
ffmpeg -i 2205Z.ts -map 0:2 -bsf "noise=drop=mod(n\,100)" -f segment -segment_format data -segment_time 0.01 %d.bin
The noise bsf uses an expression to drop, not select i.e. select=EXPR === drop=not(EXPR)
.
Add -loglevel verbose
to see details about which packets are kept, in a format like this:
[noise @ 000001cd418a68c0] Stream #2 packet 1099 pts 3420417 - amount 0 drop 1
[noise @ 000001cd418a68c0] Stream #2 packet 1100 pts 3423419 - amount 0 drop 0
[noise @ 000001cd418a68c0] Stream #2 packet 1101 pts 3426423 - amount 0 drop 1