Hi,
I've been botten by the 2GB file size split and would like to: 1) create a single file. "cat *.ts" > result.ts does not work well because if I watch the resulting file with mplayer, i get out of sync video and sound at the original split location 2) edit the resulting file to remove uneeded time stamp (beginning and end typically) I'm sure the question has been ask 1000 times but using google I cannot find anything that actually works
-- eric
On 27.03.2010 12:10, Eric Valette wrote:
Hi,
I've been botten by the 2GB file size split and would like to: 1) create a single file. "cat *.ts" > result.ts does not work well because if I watch the resulting file with mplayer, i get out of sync video and sound at the original split location
I don't see why there should be any interruption at these points. VDR simply switches from one file to the next when recording. There is nothing special at the beginning or end of the files.
2) edit the resulting file to remove uneeded time stamp (beginning
and end typically)
What "uneeded time stamp" do you mean?
Klaus
On 27/03/2010 12:13, Klaus Schmidinger wrote:
On 27.03.2010 12:10, Eric Valette wrote:
Hi,
I've been botten by the 2GB file size split and would like to: 1) create a single file. "cat *.ts"> result.ts does not work well because if I watch the resulting file with mplayer, i get out of sync video and sound at the original split location
I don't see why there should be any interruption at these points. VDR simply switches from one file to the next when recording. There is nothing special at the beginning or end of the files.
Well I do not understand either but try with smplayer and you will see strange thing happen (slow motion; out of sync, bad timestand displayed, ...). Each .ts works fine in mplayer, not the result of the cat command.
Note that its VC1 + eac3 (HDTV in france).
2) edit the resulting file to remove uneeded time stamp (beginning
and end typically)
What "uneeded time stamp" do you mean?
Removing part of the record that is not what I wanted to record (typically a few minutes before and after the complete record).
-- eric
O
Well I do not understand either but try with smplayer and you will see strange thing happen (slow motion; out of sync, bad timestand displayed, ...). Each .ts works fine in mplayer, not the result of the cat command.
Note that its VC1 + eac3 (HDTV in france).
Note the error below when trying to convert the "cat merged ts files" into a mkv
[matroska @ 0x66ace0]st:2 error, non monotone timestamps 147691 >= 147691ts/s
---------------------
valette@tri-yann3:~$ ffmpeg -i /multimedia/Video/foo.ts -vcodec copy -sameq -acodec copy -sameq -scodec copy -f matroska /multimedia/Video/foo.mkv FFmpeg version UNKNOWN, Copyright (c) 2000-2010 the FFmpeg developers
built on Mar 21 2010 12:00:07 with gcc 4.4.3
configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libfaad --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libtheora --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-avfilter-lavf --enable-libopenjpeg --enable-version3 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis libavutil 50.12. 0 / 50.12. 0 libavcodec 52.59. 0 / 52.59. 0 libavformat 52.56. 1 / 52.56. 1 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.18. 0 / 1.18. 0 libswscale 0.10. 0 / 0.10. 0 libpostproc 51. 2. 0 / 51. 2. 0 [h264 @ 0x667dc0]number of reference frames exceeds max (probably corrupt input), discarding one Last message repeated 39 times [h264 @ 0x667dc0]mmco: unref short failure Last message repeated 1 times [mpegts @ 0x64b5f0]max_analyze_duration reached Input #0, mpegts, from '/multimedia/Video/foo.ts': Duration: 02:39:54.00, start: 93129.649278, bitrate: 7907 kb/s Program 132 Stream #0.0[0x2d0]: Video: h264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc Stream #0.1[0x2da](fra): Audio: mp2, 48000 Hz, 2 channels, s16, 256 kb/s Stream #0.2[0x2db](deu): Audio: mp2, 48000 Hz, 2 channels, s16, 256 kb/s Stream #0.3[0x2e4](fra): Subtitle: dvbsub Stream #0.4[0x2e5](deu): Subtitle: dvbsub Stream #0.5[0x2e6](fra): Subtitle: dvbsub [matroska @ 0x66ace0]Codec for stream 2 does not use global headers but container format requires global headers Output #0, matroska, to '/multimedia/Video/foo.mkv': Metadata: encoder : Lavf52.56.1 Stream #0.0: Video: libx264, yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], q=2-31, 1k tbn, 25 tbc Stream #0.1(fra): Audio: mp2, 48000 Hz, 2 channels, 256 kb/s Stream #0.2(fra): Subtitle: dvbsub Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Stream #0.3 -> #0.2 Press [q] to stop encoding [matroska @ 0x66ace0]st:2 error, non monotone timestamps 147691 >= 147691ts/s Last message repeated 427 times33841kB time=147.69 bitrate=7423.8kbits/s [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=1050, dts=8589914042, size=22580 [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=13650, dts=8589926642, size=43564 [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=15450, dts=8589928442, size=23132 [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=6450, dts=8589930242, size=30860 [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=8250, dts=8589932042, size=20924 [mpegts @ 0x64b5f0]Invalid timestamps stream=0, pts=2850, dts=8589933842, size=5468 [matroska @ 0x66ace0]st:2 error, non monotone timestamps 147691 >= 147691s/s Processus arrêté=212 q=-1.0 size= 133850kB time=147.69 bitrate=7424.3kbits/s
On 27.03.2010 12:19, Eric Valette wrote:
On 27/03/2010 12:13, Klaus Schmidinger wrote:
On 27.03.2010 12:10, Eric Valette wrote:
Hi,
I've been botten by the 2GB file size split and would like to: 1) create a single file. "cat *.ts"> result.ts does not work well because if I watch the resulting file with mplayer, i get out of sync video and sound at the original split location
I don't see why there should be any interruption at these points. VDR simply switches from one file to the next when recording. There is nothing special at the beginning or end of the files.
Well I do not understand either but try with smplayer and you will see strange thing happen (slow motion; out of sync, bad timestand displayed, ...). Each .ts works fine in mplayer, not the result of the cat command.
I just made a recording with a 1MB file size and cat'ed the files together. The result played just fine on my FF-DVBS card.
BTW: looks like you have a "Reply-to" header set in your postings, that's why my replies may not have gone to the list. Please remove that, so that replies go to the list.
Klaus
On 28/03/2010 15:16, Klaus Schmidinger wrote:
I just made a recording with a 1MB file size and cat'ed the files together. The result played just fine on my FF-DVBS card.
It indeed works with xbmc, not with smplayer. Anyway I've found a way to make it work (and now I will have only one chunk) :
ffmpeg -y -ss 00:17:00 -map 0.0 -map 0.1 -i 00001.ts -vcodec copy -sameq -acodec copy simplified1.ts ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 1.mkv ... ffmpeg -t 00:14:10 -y -map 0.0 -map 0.1 -i 00004.ts -vcodec copy -sameq -acodec copy simplified4.ts ffmpeg -y -i simplified4.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 4.mkv
mkvmerge --title Foo 1.mkv +2.mkv +3.mkv +4.mkv -o foo.mkv
BTW: looks like you have a "Reply-to" header set in your postings, that's why my replies may not have gone to the list.
Its my default reply-to...
--eric
Eric Valette wrote:
On 28/03/2010 15:16, Klaus Schmidinger wrote:
I just made a recording with a 1MB file size and cat'ed the files together. The result played just fine on my FF-DVBS card.
It indeed works with xbmc, not with smplayer. Anyway I've found a way to make it work (and now I will have only one chunk) :
ffmpeg -y -ss 00:17:00 -map 0.0 -map 0.1 -i 00001.ts -vcodec copy -sameq -acodec copy simplified1.ts ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 1.mkv ... ffmpeg -t 00:14:10 -y -map 0.0 -map 0.1 -i 00004.ts -vcodec copy -sameq -acodec copy simplified4.ts ffmpeg -y -i simplified4.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 4.mkv
mkvmerge --title Foo 1.mkv +2.mkv +3.mkv +4.mkv -o foo.mkv
vdr does not look for any strukture of a recorded file it just cut's when the byte conter limit for a file is reached
imho your method is not good you will loose data on the file borders wich will result in gaps and async audio
converting every file of a recording in sigle file mode will end in "open" data on start and end that will be lost so every end and start of a file means loosig a whole iframe with all following frames to the next iframe same for audio and that can get worse when audio anv video are interleaved be a "gap" i.e. audio ist 300ms later then the picture you will have a 300ms audio gap at the start aof every file
On 28.03.2010 17:23, Lars Bla"ser wrote:
Eric Valette wrote:
On 28/03/2010 15:16, Klaus Schmidinger wrote:
I just made a recording with a 1MB file size and cat'ed the files together. The result played just fine on my FF-DVBS card.
It indeed works with xbmc, not with smplayer. Anyway I've found a way to make it work (and now I will have only one chunk) :
ffmpeg -y -ss 00:17:00 -map 0.0 -map 0.1 -i 00001.ts -vcodec copy -sameq -acodec copy simplified1.ts ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 1.mkv ... ffmpeg -t 00:14:10 -y -map 0.0 -map 0.1 -i 00004.ts -vcodec copy -sameq -acodec copy simplified4.ts ffmpeg -y -i simplified4.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 4.mkv
mkvmerge --title Foo 1.mkv +2.mkv +3.mkv +4.mkv -o foo.mkv
vdr does not look for any strukture of a recorded file it just cut's when the byte conter limit for a file is reached ...
VDR starts each file with an I-frame:
bool cRecorder::NextFile(void) { if (recordFile && frameDetector->IndependentFrame()) { // every file shall start with an independent frame if (fileSize > MEGABYTE(off_t(Setup.MaxVideoFileSize)) || RunningLowOnDiskSpace()) { recordFile = fileName->NextFile(); fileSize = 0; } } return recordFile != NULL; }
Klaus
On 28/03/2010 17:23, Lars Bläser wrote:
vdr does not look for any strukture of a recorded file it just cut's when the byte conter limit for a file is reached
imho your method is not good you will loose data on the file borders which will result in gaps and async audio
converting every file of a recording in single file mode will end in "open" data on start and end that will be lost so every end and start of a file means loosig a whole iframe with all following frames to the next iframe same for audio and that can get worse when audio anv video are interleaved be a "gap" i.e. audio ist 300ms later then the picture you will have a 300ms audio gap at the start aof every file
Granted. However, merging with cat *.ts > complete.ts + trying a single pass mkv conversion fails miserably (allhough I have very up to date ffmpeg version).
See fourth message in this threads ffmpeg complain with non monotone timestamps and simply hang the computer.
That's why I asked if the 2GB limit was really gone to avoid splitting the files.
--eric
On 28/03/2010 17:45, Eric Valette wrote:
On 28/03/2010 17:23, Lars Bläser wrote:
Granted. However, merging with cat *.ts > complete.ts + trying a single pass mkv conversion fails miserably (allhough I have very up to date ffmpeg version).
See fourth message in this threads ffmpeg complain with non monotone timestamps and simply hang the computer.
I just tryed remuxing the .ts (and removing unneeded languages and subtitles) file to another .ts before converting to matroska and it works!
cat 00001.ts 00002.ts > merged.ts ffmpeg -y -ss 00:01:06 -map 0.0 -map 0.1 -i merged.ts -vcodec copy -sameq -acodec copy simplified1.ts ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 1.mkv
Much simpler indeed and no risk to have a small glitch in the meddle of the cut.
Grreee. I will need another night to redo better .mkv.
-- eric
On 28.03.2010 18:12, Eric Valette wrote:
On 28/03/2010 17:45, Eric Valette wrote:
On 28/03/2010 17:23, Lars Bläser wrote:
Granted. However, merging with cat *.ts > complete.ts + trying a single pass mkv conversion fails miserably (allhough I have very up to date ffmpeg version).
See fourth message in this threads ffmpeg complain with non monotone timestamps and simply hang the computer.
I just tryed remuxing the .ts (and removing unneeded languages and subtitles) file to another .ts before converting to matroska and it works!
cat 00001.ts 00002.ts > merged.ts ffmpeg -y -ss 00:01:06 -map 0.0 -map 0.1 -i merged.ts -vcodec copy -sameq -acodec copy simplified1.ts ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -async 2 -f matroska 1.mkv
Much simpler indeed and no risk to have a small glitch in the meddle of the cut.
Where do you take that time offset value from? I'm also working on such kind of scripts right now, because I want to remux especially HD recordings to MKV. In the case of movies broadcasted by ARD HD or ZDF HD (720p@50Hz), they are full of so-called filler-NALUs, which can be removed just by muxing into MKV not directly by ffmpeg, but by mkvmerge, which shrinks a 10GB movie to about 3GB. My problem is still A/V sync, all the original TS chunks (I also record into 200MB pieces, because of fast editing in VDR) show video delays for each audio track of over 1 second, which is also very noticeable ion the final converted MKV. The delays are reported both by tsMuxeR and mediainfo see for example the "Video delay" value below:
mediainfo 00001.ts General ID : 8008 Complete name : 00001.ts Format : MPEG-TS File size : 200 MiB Duration : 2mn 6s Overall bit rate : 13.3 Mbps
Video ID : 6010 (0x177A) Menu ID : 132 (0x84) Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : Yes Format settings, ReFrames : 5 frames Duration : 2mn 5s Bit rate : 11.5 Mbps Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate : 50.000 fps Resolution : 8 bits Colorimetry : 4:2:0 Scan type : Progressive Bits/(Pixel*Frame) : 0.249 Stream size : 172 MiB (86%) Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177 Transfer characteristics : BT.709-5, BT.1361 Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177
Audio #1 ID : 6020 (0x1784) Menu ID : 132 (0x84) Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Duration : 2mn 5s Bit rate mode : Constant Bit rate : 256 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Video delay : -1s 340ms Stream size : 3.84 MiB (2%) Language : German Language, more info : Clean effects
Audio #2 ID : 6021 (0x1785) Menu ID : 132 (0x84) Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Duration : 2mn 5s Bit rate mode : Constant Bit rate : 256 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Video delay : -1s 344ms Stream size : 3.84 MiB (2%) Language : German Language, more info : Clean effects
Audio #3 ID : 6022 (0x1786) Menu ID : 132 (0x84) Format : AC-3 Format/Info : Audio Coding 3 Duration : 2mn 5s Bit rate mode : Constant Bit rate : 448 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Video delay : -1s 486ms Stream size : 6.73 MiB (3%) Language : German Language, more info : Clean effects
Where do you take that time offset value from?
I play the simplified ts file using smplayer -ss is the start in the ts file, -t is the duration to add to the -ss value (I would have prefered the absolute end avoiding a substract...).
I'm also working on such kind of scripts right now, because I want to remux especially HD recordings to MKV. In the case of movies broadcasted by ARD HD or ZDF HD (720p@50Hz), they are full of so-called filler-NALUs, which can be removed just by muxing into MKV not directly by ffmpeg, but by mkvmerge, which shrinks a 10GB movie to about 3GB.
You mean you extract the various component (audio, video) into separate files and then reassemble them using mkvmerge?
My problem is still A/V sync, all the original TS chunks (I also record into 200MB pieces, because of fast editing in VDR) show video delays for each audio track of over 1 second, which is also very noticeable ion the final converted MKV. The delays are reported both by tsMuxeR and mediainfo see for example the "Video delay" value below:
Yes I know this is why the "async 2, (+ vsync 2 for récent ffmpeg version)" is there. Without them I have the audio and the video out of sync just like you.
ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -vsync 2 -async 2 -f matroska 1.mkv
I'll post the mediainfo on the ts and mkv when back at home.
-- eric
On 01.04.2010 13:23, Eric Valette wrote:
Where do you take that time offset value from?
I play the simplified ts file using smplayer -ss is the start in the ts file, -t is the duration to add to the -ss value (I would have prefered the absolute end avoiding a substract...).
So for now you're determining that value sort of experimentally?
I'm also working on such kind of scripts right now, because I want to remux especially HD recordings to MKV. In the case of movies broadcasted by ARD HD or ZDF HD (720p@50Hz), they are full of so-called filler-NALUs, which can be removed just by muxing into MKV not directly by ffmpeg, but by mkvmerge, which shrinks a 10GB movie to about 3GB.
You mean you extract the various component (audio, video) into separate files and then reassemble them using mkvmerge?
Yes, I'm demuxing all the 000xy.ts files in all their component streams with ffmpeg for now first, then multiplex the ones I want with mkvmerge. I might switch to tsMuxeR, maybe also convert back to cleaned-up TS from MKV also with tsMuxeR to make the smaller recording again playable by VDR (I've read in the vdr-portal.de forum some users already experimented with this).
My problem is still A/V sync, all the original TS chunks (I also record into 200MB pieces, because of fast editing in VDR) show video delays for each audio track of over 1 second, which is also very noticeable ion the final converted MKV. The delays are reported both by tsMuxeR and mediainfo see for example the "Video delay" value below:
Yes I know this is why the "async 2, (+ vsync 2 for récent ffmpeg version)" is there. Without them I have the audio and the video out of sync just like you.
ffmpeg -y -i simplified1.ts -vcodec copy -sameq -acodec copy -vsync 2 -async 2 -f matroska 1.mkv
I'll post the mediainfo on the ts and mkv when back at home.
By "simplified" you mean the merged ts?
Lucian
On 04/01/2010 02:24 PM, Lucian Muresan wrote:
On 01.04.2010 13:23, Eric Valette wrote: So for now you're determining that value sort of experimentally?
No. This is not the lag beween audio and video this is the timestamp displayed by smplayer when the video really starts (you have 2 min before and 10 min after by default with vdr that I want to cut).
Yes, I'm demuxing all the 000xy.ts files in all their component streams with ffmpeg for now first, then multiplex the ones I want with mkvmerge. I might switch to tsMuxeR, maybe also convert back to cleaned-up TS from MKV also with tsMuxeR to make the smaller recording again playable by VDR (I've read in the vdr-portal.de forum some users already experimented with this).
I'm not a codec format spécialist but do individual codec have their own absolute time stamp? so that you can sync them when multiplexing them later on? The lag in the TS stream is not constant by any mean at least on french HD stream, I keeps getting higher and highger if I do not force to sync them (up to a point it crash the player)
By "simplified" you mean the merged ts?
No the one where I removed anything not needed (subtitles, foreign language, ...). I have 6 stream when I actually only need two. So I strip down the ts stream first and then remux.
-- eric