├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Leandro Moreira 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | A set of command lines examples to help debugging video streaming files like mp4, ts ,fmp4 in Dash, HLS, or MSS, with or without DRM. 4 | 5 | # The tools 6 | 7 | * [FFprobe](https://ffmpeg.org/ffprobe.html) - A generic tool for media streaming debug 8 | * [Mediainfo](https://mediaarea.net/en/MediaInfo) - A generic tool for media streaming info 9 | * [TSDuck](https://tsduck.io/#cmdlist) - A tool more specific for TS (MPEG-2 Part 1) 10 | * [Bento4](https://www.bento4.com/) - A tool more specific for MP4 (MPEG-4 Part 14) 11 | 12 | 13 | ## Overview of the streams 14 | 15 | ```bash 16 | ffprobe -i file.extension 17 | 18 | # trace will output like a parser, it's useful for learning also check container structure such as fragmented mp4, mpegts programs... 19 | ffprobe -v trace file.extension 20 | 21 | mediainfo file.extension 22 | 23 | tsdump file.ts 24 | tsanalyze file.ts 25 | tstables file.ts 26 | # .. tsXXXX 27 | 28 | mp4info file.mp4 29 | mp4dump # this is useful for fragmented mp4 30 | # mp4XXXXX 31 | ``` 32 | 33 | ## Specific info from the streams 34 | 35 | ```bash 36 | # -select_streams v is filtering only video streams 37 | ffprobe -loglevel panic -select_streams v -show_entries "stream=start_pts,start_time,avg_frame_rate,r_frame_rate,codec_time_base" file.extension 38 | 39 | # logging/printing HDR metada information from FFmpeg 40 | # source: https://www.reddit.com/r/ffmpeg/comments/qidrc8/comment/i9lrj9u/?utm_source=reddit&utm_medium=web2x&context=3 41 | ffprobe -loglevel quiet -read_intervals "%+#2" -select_streams v:0 -show_entries side_data "input.mkv" | egrep -m 1 -A 10 'Mastering display metadata' | grep -v 'Mastering display metadata' >/tmp/variables.txt 42 | ffprobe -loglevel quiet -read_intervals "%+#2" -select_streams v:0 -show_entries side_data "input.mkv" | egrep -m 1 -A 2 'Content light level metadata' | grep -v 'Content light level metadata' >>/tmp/variables.txt 43 | cat /tmp/variables.txt 44 | ``` 45 | ## Specific info from some frames 46 | 47 | ```bash 48 | ffprobe -loglevel panic -select_streams v -show_entries "frame=pkt_pts,pkt_pts_time,pkt_duration,best_effort_timestamp,best_effort_timestamp_time" -read_intervals %+#5 49 | ``` 50 | 51 | ## Codec/Container parsing-like info from the stream 52 | 53 | ```bash 54 | 55 | mediainfo --Details=1 file.extension 56 | 57 | ``` 58 | 59 | ## Video/Audio/ClosedCaptions/Container/Codec ffmpeg samples 60 | 61 | https://samples.ffmpeg.org/ 62 | 63 | --------------------------------------------------------------------------------