Do ".ts" video recording (MPEG transport stream) contain multiple program recordings ?

Michael Freeman

New Member
Hi,

I've been looking at cutting down ".ts" video files I have transferred off the device. I did a search for this but could only find the on device firmware add on that shrinks the .ts file a bit. But it was not clear if there are multiple programs recorded in the ".ts" (MPEG transport stream) file. For example "ffmpeg -i Under\ Siege\,\ 1992\ Part\ 1.ts" (about half the feature @ 1.2 GB) shows ...

Code:
MichaelZFreeman@linux-freeman-G41MT-S2PT ~/Videos
$ ffmpeg -i Under\ Siege\,\ 1992\ Part\ 1.ts
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[mpeg2video @ 0x55db475a0be0] Invalid frame dimensions 0x0.
    Last message repeated 11 times
[mpegts @ 0x55db47577760] start time for stream 2 is not set in estimate_timings_from_pts
[mpegts @ 0x55db47577760] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 0x55db47577760] PES packet size mismatch
[mpegts @ 0x55db47577760] Could not find codec parameters for stream 2 (Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'Under Siege, 1992 Part 1.ts':
  Duration: 01:09:57.18, start: 37839.794311, bitrate: 2374 kb/s
  Program 12928
    Metadata:
      service_name    : 5STAR
      service_provider:
    Stream #0:0[0x1a11]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 544x576 [SAR 32:17 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1a12](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:2[0x1a13](eng): Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, s16p (visual impaired)
    Stream #0:3[0x1a16](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
  Program 12992
    Metadata:
      service_name    : 5 USA
      service_provider:
  Program 13024
    Metadata:
      service_name    : Channel 5+1
      service_provider:
  Program 13120
    Metadata:
      service_name    : QVC
      service_provider:
  Program 14384
    Metadata:
      service_name    : Blaze
      service_provider:
  Program 14388
    Metadata:
      service_name    : Blaze+1
      service_provider:
  Program 14412
    Metadata:
      service_name    : Hochanda
      service_provider:
  Program 14416
    Metadata:
      service_name    : Box Nation
      service_provider:
  Program 14424
    Metadata:
      service_name    : Rocks and Co
      service_provider:
  Program 14440
    Metadata:
      service_name    : QUEST+1
      service_provider:
  Program 14448
    Metadata:
      service_name    : CBS Reality
      service_provider:
  Program 14480
    Metadata:
      service_name    : Horror Channel
      service_provider:
  Program 14488
    Metadata:
      service_name    : TCC
      service_provider:
  Program 14498
    Metadata:
      service_name    : QUEST
      service_provider:
  Program 14532
    Metadata:
      service_name    : The Store
      service_provider:
  Program 14544
    Metadata:
      service_name    : ADULT Xpanded TV
      service_provider:
  Program 14576
    Metadata:
      service_name    : ADULT Studio 66
      service_provider:
  Program 14608
    Metadata:
      service_name    : True Entertainment
      service_provider:
  Program 14688
    Metadata:
      service_name    : Absolute Radio
      service_provider:
  Program 14720
    Metadata:
      service_name    : Heart
      service_provider:
  Program 14752
    Metadata:
      service_name    : Capital
      service_provider:
  Program 15000
    Metadata:
      service_name    : Loveworld
      service_provider:
  Program 15016
    Metadata:
      service_name    : Sonlife
      service_provider:
  Program 15032
    Metadata:
      service_name    : Racing UK
      service_provider:
  Program 15048
    Metadata:
      service_name    : CCTV
      service_provider:
  Program 15056
    Metadata:
      service_name    : CONNECT 4
      service_provider:
  Program 15064
    Metadata:
      service_name    : Planet Knowledge
      service_provider:
  Program 15072
    Metadata:
      service_name    : Asia TV
      service_provider:
  Program 15200
    Metadata:
      service_name    : ADULT Section
      service_provider:
  Program 15232
    Metadata:
      service_name    : Television X
      service_provider:
  Program 15432
    Metadata:
      service_name    : Arise News
      service_provider:
  Program 15456
    Metadata:
      service_name    : VisionTV
      service_provider:
  Program 15464
    Metadata:
      service_name    : Sports Channel Network
      service_provider:
  Program 15512
    Metadata:
      service_name    : ADULT Party
      service_provider:
  Program 15856
    Metadata:
      service_name    : ITVBe
      service_provider:
  Program 15864
    Metadata:
      service_name    : ITVBe+1
      service_provider:
  Program 15920
    Metadata:
      service_name    : ITV4+1
      service_provider:
  Program 15952
    Metadata:
      service_name    : ITV2 +1
      service_provider:
  Program 16016
    Metadata:
      service_name    : ITV3+1
      service_provider:
  Program 16032
    Metadata:
      service_name    : CITV
      service_provider:
  Program 16048
    Metadata:
      service_name    : ITV3
      service_provider:
  Program 16080
    Metadata:
      service_name    : 5SELECT
      service_provider:
  Program 16200
    Metadata:
      service_name    : Ketchup TV
      service_provider:
  Program 16208
    Metadata:
      service_name    : Drama
      service_provider:
  Program 14784
    Metadata:
      service_name    : 365 Travel
      service_provider:
  Program 15208
    Metadata:
      service_name    : 695
      service_provider:
  Program 15176
    Metadata:
      service_name    : 696
      service_provider:

Are the "Programs" different features recorded into the same file ? Looking at the "Streams" near the top of the file I don't think they are and it's just metadata. However seeing as the live video data sent over the air is known to include multiple video streams this has been confusing me a bit. Can anyone clarify ?
 
You get metadata for each of the channels in the same multiplex as the recorded channel plus basic information about the streams. In your example, there are four streams: 0 = video, 1 = main audio, 2 = audio description and 3 = DVB-subtitles. By default, ffmpeg only scans five seconds of the streams, and the format of the audio description stream is often not detected. If you want to view the format of the audio description stream you will need to increase two parameters as indicated in the error message in your example. Something like this usually works:
ffmpeg -probesize 60M -analyzeduration 60M -i Filename.ts.
 
Recordings are easily shrunk to the essentials on-the-box using the "Shrink" option on the WebIF media browser. To do the same off-box, feed the same parameters into ffmpeg:

https://hummy.tv/forum/threads/dlna-to-smart-tvs.1815/post-23180
The ffmpeg command line in the quoted example will only copy the main video and audio streams, not the audio description or subtitles (if these streams are present, of course). I have not found one single command line with ffmpeg that covers all eventualities: audio description (AD) is the stumbling block. You can increase the 'probesize' and 'analyzeduration' to allow the AD stream to be recognised and copied, but this is not the only problem. By default, ffmpeg will only copy the main video and audio streams. If you add the '-map 0' and '-ignore_unknown' commands it will copy all known stream types but sometimes, when a recording does not have a audio description track, a dummy stream is transmitted. This will be detected as an mp3 stream but as there is no associated data it will fail to copy and the whole copy process will fall over.
The easiest solution is to use the 'stripts' package to remove the EIT packets. On an MPEG recording, the file size is reduced significantly (H264 recordings less so). I noticed that the OP, @Michael Freeman, was using a Linux machine. There is a Linux version of stripts available for download on this site, and the available commands are described in the wiki. From the wiki: stripts -f filename to remove redundant EIT packets.
 
detectads is wonderful. I use it to just mark the end of each block of advertisements. On playback, when an advertisement starts one press of the skip to bookmark button gets you to the next program segment. It can be used to mark the start of the adverts too, and then chop them out of the recording. Fine when it works (usually does) but any errors in advertisement detection can result in the loss of part of the program.
 
But it hasn't gone. Just inconvenient to find it and fast forward to where you were at.
 
Recordings are easily shrunk to the essentials on-the-box using the "Shrink" option on the WebIF media browser. To do the same off-box, feed the same parameters into ffmpeg:

https://hummy.tv/forum/threads/dlna-to-smart-tvs.1815/post-23180

Cheers. Perfect ! That strips off a few hundred megabytes. I also trimmed the recordings with ...

Code:
ffmpeg -i input.mp4 -ss 01:10:27 -to 02:18:51 -c:v copy -c:a copy output.mp4

The ffmpeg command line in the quoted example will only copy the main video and audio streams, not the audio description or subtitles (if these streams are present, of course).

I did not mind losing subtitles and audio description but its good to know this, thanks.

So all I need to do is set up detectads. Probably safer just to set the bookmarks and use those to edit out adverts once the video file is transferred off the box. But is such a thing even possible ? Are the book marks only understandable by the Humax device ?
 
Right. Maybe the tool to pass the time index's to ffmpeg might be released at a later date. So I tried "crop" in "opt+" menu and I get the page shown in the attachment. Reminds me why this device and dev's are so great.
 

Attachments

  • Screenshot at 2018-09-15 11-45-26.png
    Screenshot at 2018-09-15 11-45-26.png
    24 KB · Views: 19
Back
Top