A Sky, cable and digital tv forum. Digital TV Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Digital TV Banter forum » Digital TV Newsgroups » uk.tech.digital-tv (Digital TV - General)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

uk.tech.digital-tv (Digital TV - General) (uk.tech.digital-tv) Discussion of all matters technical in origin related to the reception of digital television transmissions, be they via satellite, terrestrial or cable. Advertising is forbidden, with no exceptions.

snipping ts files neatly



 
 
Thread Tools Display Modes
  #11  
Old December 16th 14, 04:12 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Tony Houghton[_3_]
external usenet poster
 
Posts: 6
Default snipping ts files neatly

In ,
Jim Lesurf wrote:

BTW Out of curiosity I also just tried playing some VOB files ripped from a
home recorded DVD-RW (Panasonic DVD videorecorder) and the TV media
player does play them. Just has no idea how long they are so you can only
get 'play' and 'pause' to work meaningfully. Presumably the content needs
're-containering' in a suitable way.

I'll have a look at VideoRedo, but I don't really want a full editor. Just
something that will snip safely and do any 'fix' like add required metadata
packets as per above via command line. I'm also curious about the 'license'
mentioned.


This is something I haven't done in a long while, but I used to use
Project-X to extract mpeg2 audio and video streams (and cut adverts)
from my DVB recordings then mplex to remultiplex them to MPEG PS or DVD.
Unfortunately Project-X still doesn't support H264. I had trouble
finding a way to convert an HD DVB recording to something more
player-friendly; I think I used mkvmerge or something related in the
end. I'd be surprised if ffmpeg or avconv couldn't convert from VOB to
MPEG PS.
  #12  
Old December 16th 14, 04:20 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Jim Lesurf[_2_]
external usenet poster
 
Posts: 4,141
Default snipping ts files neatly

In article , NY
wrote:
"Jim Lesurf" wrote in message
...
I'll have a look at VideoRedo, but I don't really want a full editor.
Just something that will snip safely and do any 'fix' like add
required metadata packets as per above via command line. I'm also
curious about the 'license' mentioned.


VideoReDo isn't a full editor.


[snip info]

Any comments on gopchop or avidemux? My distro offers both as packages.
However I can't tell yet if either will work with HD ts files from what
I've found so far.

I've also now found my old homebrew 'pidsniffer' programs, so may
experiment with them to list where PAT and PMT packets appear in a file,
then try snipping at a PAT, etc, to experiment.

If possible I want 'breaks' that link with no disruption. i.e. akin to
using a 'gapless' audio player. The same content so far as any media player
is concerned, but split into smaller files.

Jim

--
Please use the address on the audiomisc page if you wish to email me.
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Armstrong Audio http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc http://www.audiomisc.co.uk/index.html

  #13  
Old December 16th 14, 11:12 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Andy Furniss[_3_]
external usenet poster
 
Posts: 130
Default snipping ts files neatly

Jim Lesurf wrote:

I've also now found my old homebrew 'pidsniffer' programs, so may
experiment with them to list where PAT and PMT packets appear in a
file, then try snipping at a PAT, etc, to experiment.


Not sure if that will help or not.

I had some really bad code that finds the Random access indicators in
the ts headers. The only way it helped was to get a clean start on the
video stream - it still took several cuts to avoid logging noise from
command line ffmpeg players.

If I have a stream with an unlucky start in the sense that it doesn't
work, which is rare, I just chop off a few hundred packets.

Players vary - they may require/read the PMT or not, also consider if
you are recording with tzap the PMT will refer to streams that you
didn't actually record (subs/ad).

If possible I want 'breaks' that link with no disruption. i.e. akin
to using a 'gapless' audio player. The same content so far as any
media player is concerned, but split into smaller files.


That will be tricky as the sound is ahead of vid in the stream. When
playing some players will freeze vid waiting for sound, some will start
both and play vid slow till sync is achieved.

If you were to copy to a new container then you will get the same
variation depending on the container. If you were to try changing
containers you may not be able to just copy latm and if the sound
switched channel layouts that would be an issue as some containers won't
handle that. I've never bothered personally, just saying there are
caveats should you try.


  #14  
Old December 17th 14, 12:22 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Tony Houghton[_3_]
external usenet poster
 
Posts: 6
Default snipping ts files neatly

In ,
Andy Furniss [email protected] wrote:

Players vary - they may require/read the PMT or not, also consider if
you are recording with tzap the PMT will refer to streams that you
didn't actually record (subs/ad).


That's a good point which I forgot about. If the recording is from DVB
they won't refer only to missing subtitles etc but to entire channels. A
player would have to read ahead to work out which streams are actually
present in the file.
  #15  
Old December 18th 14, 12:53 AM posted to uk.tech.digital-tv,uk.comp.os.linux
Johny B Good[_2_]
external usenet poster
 
Posts: 853
Default snipping ts files neatly

On Tue, 16 Dec 2014 10:18:26 +0000 (GMT), Jim Lesurf
wrote:

I'd be interested in info on simple programs to let me 'snip' a long ts
file into shorter segments at playback times that suit me.

I'm aware that the ts file is packeted, and have in the past experimented
simply with using dd to snip oup sections to new files that respect the
packet boundaries. However its clear that I also need to respect the
locations of some of the metadata packets that specifiy details.

I don't want to change or recodec the contents, although a conversion that
simply removes the ts 'wrapper' and gives me the same content in a more
useable file format might make sense.

This is all for HDTV ts streams I've recorded. e.g. A typical file might be
about 3GB in size and have a playback duration of, say, around an hour. It
may contain items such that I want to split it into sections that begin at
specific times. e..g. a concert where I want files which each start with a
successive item of music. Same data as the source file, but now in a
consecutive series of smaller files.

Happy to do the actual splitting via command line as I can determine the
relevant instants by first using VLC or similar.

Advice and info?

Jim


MPEG_Streamclip is quite good for that. Only win and Mac install
packages but, these days, it should be a fairly trivial task to run it
in a virtualised winXP session in any Linux host (VirtualBox should do
the trick for you). You'll also need Quicktime Alternative v1.81
installed on the WinXP VM and, if you're dealing with rejoining the
seperate parts of a de-commercialled programme, MPEG2Cut is a handy
way to join them all up (but run the resulting MPG through
MPEG_Streamclip again to normalise the timecode via the edit dropdown
Fix Timecode Breaks option).


MPEG_Streamclip is very swift. the processing speed is _very_
dependent of the read write performance of the storage media involved.
For media files small enough ti fit into a read cache (1.5GB in my
case) I typically see BBC sourced SD material processed at about 100
times faster than real time, and that's to a rather stodgy 2TB HDD!
Gawd alone knows just how much faster the process would be if I had
two seperate SSDs attached via 6Gbps SATA ports instead of a single
180GB SSD and a 2TB HDD plugged into 3Gbps ports.

If you run recording software that claims to produce PS files
directly (DTVR in my case), It can be rather revealing to 'convert'
these MPG files into, well, MPG files. If the output file looks about
1.4% smaller, then it simply means your recording software was doing
the absolute bare minimum of processing the TS into a PS compatable
MPG file.

The slight reduction in file size is of only a minor benefit, it's
the removal of the redundent (presumably surplus to requirements) TS
FEC clutter that seems to reduce seek bar navigation glitches in
windows mediaplayer V6.4 (no ****ty overcomplex MP 10 or higher on
this win2k box! ;-). Mind you, I did eventually realise that what
really helped avoid re-syncing delays when seeking in MP6 was choosing
the output file option "Headed MPG" rather than just MPG in
MPEG_Streamclip. Luckily for me, all those earlier conversions can
simply be reprocessed again in MPEG_Streamclip using the "Headed MPG"
option - MPEG_Streamclip doesn't mind that you're asking it to convert
an MPG file into an MPG file (Nice!).
--
J B Good
  #16  
Old December 18th 14, 08:36 AM posted to uk.tech.digital-tv,uk.comp.os.linux
Jim Lesurf[_2_]
external usenet poster
 
Posts: 4,141
Default snipping ts files neatly

In article , Johny B Good
wrote:
[snip]

MPEG_Streamclip is quite good for that. Only win and Mac install
packages but, these days, it should be a fairly trivial task to run it
in a virtualised winXP session in any Linux host (VirtualBox should do
the trick for you).


Except that I'm not sure where I even have a copy of Windows of any kind.
No doubt I have some CDRs somewhere. But then I have hundreds of CDs and
DVDs all over the place. Needle in a haystack.

I've been wondering if it may make more sense to try and use ffmpeg to
'convert' the ts files into a more convenient format. Ideally, one that
contains the same actual codec data so is a loss-free conversion. In
essence a re-containerisation or removal of the ts packeting to just have
the contents.

I'm wondering if that will play better on the TV and may be easier to snip
as I won't have the PAT/PMT/etc packet level to take into account.

All being well, I'll make some short test recordings and experiment later
today. Ideas on the best way to use ffmpeg for this would be welcome. :-)

Can anyone point at a useful intro reference to the various file types. The
TV apparently plays a set of file types, but I have no idea how easily any
of them can be produced in this way. Perhaps worth a bit of
experimentation, though.

For ref here is the list of formats the TV's manual says it can accept.

AVI
video
H.264 BP/MP/HP, MPEG1, MPEG2, MPEG4 SP/ASP,VC-1,WMV vr9
audio
AAC, ADPCM, Dolby Digital, Dolby Digital Plus, DTS core, HE-AAC,
LPCM,MPEG Audio, MP3, WMA, WMA Pro

MP4 (.f4v, .m4v, .mp4)
video
H.264 BP/MP/HP, MPEG1,MPEG2, MPEG 4 SP/ASP
audio
AAC, Dolby Digital, Dolby Digital Plus, HE-AAC, MPEG Audio, MP3

MKV
video
as above
audio
as above plus DTS code, Vorbis


ASF (.asf, .wmv)
video
MPEG4 SP/ASP, VC-1, WMV ver 9
audio
AAC, Dolby Digital, Dolby Digital Plus, HE-AAC, LPCM, MP3, WMA, WMA Pro

FLV
video
H.264 BP/MP/HP
audio
AAC, MP3

3GPP (.3gp, .3g2)
Video
H.264 BP/Mp/HP, MPEG3 SP/ASP
audio
AAC,HE-AAC

PS (.mod. .mpg .mpeg .vob .vro)
video
H.264 BP/MP/HP, MPEG1 MPEG2 VC-1
audio
AAC, Dolby Digital, Dolby Digital Plus, HE-AAC, LPCM, MPEG Audio, MP3

TS (.mts ,m2ts .tp .trp .ts .tts)
video
H.264 BP/MP/HP MPEG 1 MPEG2 VC1
audio
as above plus DTS core

Apologies for any typos.


Jim

--
Please use the address on the audiomisc page if you wish to email me.
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Armstrong Audio http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc http://www.audiomisc.co.uk/index.html

  #17  
Old December 18th 14, 01:00 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Jim Lesurf[_2_]
external usenet poster
 
Posts: 4,141
Default snipping ts files neatly

In article , Jim Lesurf
wrote:
I've been wondering if it may make more sense to try and use ffmpeg to
'convert' the ts files into a more convenient format.


Now done a few experiments.

Simply using

ffpeg -i infile.ts outfile.mpeg

does - as you'd expect - produce a version converted to mpeg. And this will
then play using my TVs media player. Alas, both the video and audio quality
are degraded. No surprise, but a pity.

I experimented with the use of '-acodec copy' and '-vcodec copy' options.
This tends to give files for other types like .avi, .mkv, etc where the
video can be seen, but the TV fails to play the audio.

Alas, that's no use to me as its the audio that I need to keep preserved as
the orginal HE-AAC, and be able to hear it. So any advice on that would be
welcome. Failing that I'll stick with ts for now, and look more into being
able to snip that when I can.

Jim

--
Please use the address on the audiomisc page if you wish to email me.
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Armstrong Audio http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc http://www.audiomisc.co.uk/index.html

  #18  
Old December 18th 14, 01:38 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Jim Lesurf[_2_]
external usenet poster
 
Posts: 4,141
Default snipping ts files neatly

In article , Jim Lesurf
wrote:
Failing that I'll stick with ts for now, and look more into being able
to snip that when I can.


Just found by experiment that

ffmpeg -ss"00:00:30" -i infilename.ts -acodec copy -vcodec copy
-t "00:00:20" outfilename.ts

lets me create a new ts file that contains what's in the infile, starting
from 30 sec in and lasting 20 sec. The result plays OK on VLC and seems to
preserve the data.

The ordering of the parts of the command seem critical so the ss can refer
to the input and the -t to the output, etc.

So far only tried a short HTDV recording from BBC 1 HD Scot this morning.
I'll try a larger file and generate a set of 'snippets'. Then see if my TV
plays them OK. If so. Robert seems to now be my avuncular relative. :-)

Fingers crossed...

Jim

--
Please use the address on the audiomisc page if you wish to email me.
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Armstrong Audio http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc http://www.audiomisc.co.uk/index.html

  #19  
Old December 18th 14, 03:00 PM posted to uk.tech.digital-tv,uk.comp.os.linux
Tony Houghton[_3_]
external usenet poster
 
Posts: 6
Default snipping ts files neatly

In ,
Jim Lesurf wrote:

In article , Jim Lesurf
wrote:
I've been wondering if it may make more sense to try and use ffmpeg to
'convert' the ts files into a more convenient format.


Now done a few experiments.

Simply using

ffpeg -i infile.ts outfile.mpeg

does - as you'd expect - produce a version converted to mpeg. And this will
then play using my TVs media player. Alas, both the video and audio quality
are degraded. No surprise, but a pity.

I experimented with the use of '-acodec copy' and '-vcodec copy' options.
This tends to give files for other types like .avi, .mkv, etc where the
video can be seen, but the TV fails to play the audio.


I don't think TS containing H264 is all that well supported yet. Try
using mkvmerge first, then you should get the unadulterated streams but
in a Matroska container that more tools can deal with easily. If your TV
can't handle Matroska, but can handle mp4, you can use ffmpeg to convert
the mkv to mp4. Your TV might be restricted in what audio formats it
accepts though, forcing you to convert it to AAC.
  #20  
Old December 19th 14, 10:33 AM posted to uk.tech.digital-tv,uk.comp.os.linux
Jim Lesurf[_2_]
external usenet poster
 
Posts: 4,141
Default snipping ts files neatly

On 18 Dec, wrote:

So far only tried a short HTDV recording from BBC 1 HD Scot this
morning. I'll try a larger file and generate a set of 'snippets'. Then
see if my TV plays them OK. If so. Robert seems to now be my avuncular
relative. :-)


Yes, the files snipped using ffmpeg play fine on my TV. The result isn't
'gapless' as the TV still has to start the vision, then the sound comes on
a second or so later. So this is only useful for musical items like those
where a conductor, orchestra, etc, are standing silently for a few sec
before they begin to play. But nevetheless, useful as a quick way of
snipping concerts into 'one work per file' for easy access via the TV.

Out of curiosity I installed my distro's version of libav-tools so I could
compare using that version of avconv with the 'locally hand built' version
of ffmpeg I normally use. Relieved to see that the command syntax is the
same. :-)

I then did some snips of the same source ts file with the same specified
start times and durations. These also seem fine when tested with VLC (not
confirmed with the TV as yet but will do soon.)

I think the contained AV data is the same, but the two results do differ.

This is snipping a source file that is about 1800 MB into three sections.

Using ffmpeg the three resulting files add up to being about 78500k bigger
than the source. Using avconv they are about 78200k bigger than the source.

I'm not sure if this is because fmpeg tends to include a bit more at start
and end, or if it adds some metadata which avconv omits, or what.

But if the avconv produced results play OK on my TV it means I can write a
simple 'AVChopper' app to use as a front end for either. Then I can just
give the app a list of snip times for a file and it will issue the series
of relevant avconv/ffmpeg commands. Once that works I can record ts files
of arbitrary length in the first place, then snip down later as convenient
for media player use.

That said, I've not yet checked if VLC is happy with files bigger than 4GB.
I assume it is, but am I wrong?

Jim

--
Please use the address on the audiomisc page if you wish to email me.
Electronics
http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Armstrong Audio http://www.audiomisc.co.uk/Armstrong/armstrong.html
Audio Misc http://www.audiomisc.co.uk/index.html

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.SEO by vBSEO 2.4.0
Copyright 2004-2017 Digital TV Banter.
The comments are property of their posters.