[FFmpeg-user] How to decrypt .ts files into separate .ts files with ffmpeg without using a playlist?

Ted Park kumowoon1025 at gmail.com
Thu Feb 13 06:09:44 EET 2020


> I'm getting these DTS warnings when I remux the .ts parts of the train video example (decrypted or not prior to remuxing - doesn't matter) as m3u8 file into one .ts or straight into .mp4 (by using a command like "ffmpeg -allowed_extensions ALL -i chunklist.m3u8 -c copy output.mp4")
The DTS warnings are coming from stream 0, which is the timed id3 “stream” and they are not errors. The ID3 packets may be emitted sporadically, and non-monotously increasing DTS isn’t a problem. 

> If I concatenate the .ts parts into one .ts file prior to remuxing, there are no those DTS warnings, however the resulted .mp4 file like I said has 2 dropped frames at the beginning, is 1 second longer than .ts and has 30.05 fps instead of 29.97 for some reason.

I’m not able to reproduce the frame drops you mentioned, unless you mean the drops on playback? Each segment has 120 frames, and when I concat using cat or ffmpeg’s hls demuxer, the result has 360 frames, as expected. If you are talking about the drops when you play the file, those are probably the duplicate frames at the segment boundaries that are being purposely skipped. Add the -noframedrop option in ffplay to force no frame drops, though that is probably not the playback behavior you want.

Here are a list of steps I took to test.

% mkdir decrypted
% openssl aes-128-cbc -d -K 5e5852fab5eedf7c6b7a367b1fc140a1 -iv 00000000000000000000000000000000 -in part0.ts -out decrypted/part0.ts
% openssl aes-128-cbc -d -K 5e5852fab5eedf7c6b7a367b1fc140a1 -iv 00000000000000000000000000000001 -in part1.ts -out decrypted/part1.ts
% openssl aes-128-cbc -d -K 5e5852fab5eedf7c6b7a367b1fc140a1 -iv 00000000000000000000000000000002 -in part2.ts -out decrypted/part2.ts
% cat decrypted/part0.ts decrypted/part1.ts decrypted/part2.ts > decrypted/cat.ts
% grep -v '#EXT-X-KEY' chunklist.m3u8 > decrypted/chunklist.m3u8
% ffmpeg -i decrypted/chunklist.m3u8 -c copy decrypted/muxed.mp4
% ffmpeg -i decrypted/chunklist.m3u8 -c copy decrypted/muxed.ts
% ffmpeg -allowed_extensions ALL -i chunklist.m3u8 muxed.mp4
% ffplay muxed.mp4
% ffplay -noframedrop muxed.mp4
% ffplay decrypted/muxed.mp4
% ffplay decrypted/muxed.ts
% ffplay decrypted/cat.ts
% ffplay -noframedrop decrypted/muxed.mp4
% ffplay -noframedrop decrypted/muxed.ts
% ffplay -noframedrop decrypted/cat.ts


More information about the ffmpeg-user mailing list