How to cut DVB-S2 recording in TS format?

Started by M-Reimer, July 31, 2016, 03:45:04 PM

Previous topic - Next topic

Jan Gruuthuse

#15
Multi audio track? Switch position of audio track: Avidemux menu: Audio: Select track:
move ac3 track away from Track 1, or disable that track, see if that helps.
Or re-mux that video with mkvtoolnixgui, sometimes this helps too.

M-Reimer

I now even tried with all audio tracks disabled. Still impossible to cut.

I'll try another recording from the same TV channel as soon as possible.

Are there any developers here in this forum? Would it help if I split a small piece and upload this so a developer can debug this issue?

Jan Gruuthuse

see if you can make a 10 seconds recording? 50 MB to 100 MB and upload. Dev(s) can look if there is an issue.
ps:- Use a free: dropbox account, mega, https://www.wetransfer.com/ or similar webservice (free public access, without registration to download your uploaded video) thank you.

http://www.avidemux.org/admWiki/doku.php?id=tutorial:cut_ts_sample

eumagga0x2a

Quote from: M-Reimer on August 03, 2016, 02:50:37 PM
I now even tried with all audio tracks disabled. Still impossible to cut.

Please try it with a short (~100 MiB) sample cut out of the stream (not from the beginning, not from the end) like

dd if=/path/to/the/stream.ts of=/path/to/the/sample.ts bs=1M skip=500 count=100

(adjust the values for skip and count as you see fit) as well.

QuoteAre there any developers here in this forum?

Yes, mean, the owner of the project and as it seems the only developer who currently works on the backend, and ajschult.

M-Reimer

#19
I've created a 40MB sample according to your instructions. This is now from a different recording from the same channel, so the problem is not limited to one recording.

https://we.tl/RiFtZoi2u2

I'm really looking forward to what the devs find out about this file. And I really hope the problem can be reproduced and is not limited to my system...

Jan Gruuthuse

#20
The video seems fine to me.
With copy for both Audio and Video
Setting marker [A ] @ 00:00:01.020
Setting marker [ B] @ 00:00:06.180
I can save with mp4v2 or mp4 Muxer this part (partSaved)
When I cut this marked piece out, I can still save the remaining video with both mp4v2 or mp4 Muxer (TestRemainingSaved)

tested with todays build ubuntu 14.04.5 64-bit QT4 6cd247a    [i18n] Sort language + remove bad russian i18n entry (eumagga0x2a)

git checkout master
git reset --hard master
git pull


https://www.dropbox.com/s/vwkob3ryhhpmz04/TestPartSaved.mp4?dl=0
https://www.dropbox.com/s/xi2ow3lb17xw4dn/TestRemainingSaved.mp4?dl=0
https://www.dropbox.com/s/uwczkzynxnh22yi/TestPartSavedv2.mp4?dl=0
https://www.dropbox.com/s/g6weeioe62iv8gs/TestRemainingSavedv2.mp4?dl=0

v2 is with mp4v2 muxer otherwise mp4 muxer.

eumagga0x2a

WFM too, despite a couple of warnings

[AudioStream] Warning skew in dts =-633634,
[AudioStream] Warning skew lastDts=00:00:06,140
[AudioStream] Warning skew newDts=00:00:05,506 


in the console while saving. The resulting MKV

mplayer -identify -frames 0 test.mkv
MPlayer SVN-r37881-6.1.1 (C) 2000-2016 MPlayer Team

Playing test.mkv.
libavformat version 57.44.100 (internal)
libavformat file format detected.
[h264 @ 0x56379d2a76e0]Increasing reorder buffer to 1
[h264 @ 0x56379d2a76e0]Increasing reorder buffer to 2
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
ID_AID_0_LANG=deu
[lavf] stream 1: audio (mp2), -aid 0, -alang deu
ID_AUDIO_ID=1
ID_AID_1_LANG=deu
[lavf] stream 2: audio (ac3), -aid 1, -alang deu
VIDEO:  [H264]  1280x720  0bpp  50.000 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.51.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
Clip info:
ENCODER: Lavf57.25.100
ID_CLIP_INFO_NAME0=ENCODER
ID_CLIP_INFO_VALUE0=Lavf57.25.100
ID_CLIP_INFO_N=1
Load subtitles in ./
ID_FILENAME=test.mkv
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=1280
ID_VIDEO_HEIGHT=720
ID_VIDEO_FPS=50.000
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=80
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_START_TIME=0.01
ID_LENGTH=13.86
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
ID_AUDIO_BITRATE=256000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=mpg123
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF


plays fine both with the ac3 and mp2 audio.

M-Reimer

#22
OK. If I try what you did, then this works for me, too.

What I did so far: I selected a part of the recording using "Mark A" and "Mark B" and killed these parts using "Entf".

After doing my cuts (I only want to have the stuff that is still left and everything else was killed using "Entf") I wanted to Save this result.

I don't know if this workflow should work the way I'm trying to do, but this is what I do:

- Open the test.ts file and go to 00:01.020
- Set a "B" mark here, hit "Entf" (cutted out leading part)
- Now go to 00:18.960
- Set a "A" mark here, hit "Entf" (cutted out trailing part)

The leftover part is what I want to save to MKV. Trying to do so fails always for me.
Even trying to set an "A" mark to the beginning and a "B" mark to the end fails.

Yes, in this simple example I could have set "A" to 00:01.020 and "B" to 00:18.960 but there are more difficult cases. Sometimes I want to cut out several commercial breaks and I don't know how I should do this without deleting parts.

eumagga0x2a

Quote from: M-Reimer on August 04, 2016, 01:35:42 PM
OK. If I try what you did, then this works for me, too.

Well, this is the usual way to cut off the leading and the trailing part of a stream.

QuoteWhat I did so far: I selected a part of the recording using "Mark A" and "Mark B" and killed these parts using "Entf".

WFM as far as the cut doesn't begin at the start of a stream and doesn't end at the end.

QuoteAfter doing my cuts (I only want to have the stuff that is still left and everything else was killed using "Entf") I wanted to Save this result.

I don't know if this workflow should work the way I'm trying to do, but this is what I do:

- Open the test.ts file and go to 00:01.020
- Set a "B" mark here, hit "Entf" (cutted out leading part)

WFM if I save the MKV after this step and stop here.

Quote- Now go to 00:18.960
- Set a "A" mark here, hit "Entf" (cutted out trailing part)

The leftover part is what I want to save to MKV. Trying to do so fails always for me.

After this step Avidemux crashes:

Assert failed :_currentSegment==segNo
at line 461, file /home/eumagga/avidemux/git/avidemux2/avidemux/qt4/common/ADM_editor/src/ADM_edRender.cppADM_backTrack
ADM_Composer::samePicture(ADMImage*)
admPreview::samePicture()
GUI_GoToTime(unsigned long)
HandleAction(Action)
QMetaObject::activate(QObject*, int, int, void**)
MainWindow::actionSignal(Action)
MainWindow::searchMenu(QAction*, MenuEntry*, int)
QMetaObject::activate(QObject*, int, int, void**)
QMenu::triggered(QAction*)


QMetaObject::activate(QObject*, int, int, void**)
QAction::triggered(bool)
QAction::activate(QAction::ActionEvent)
QAction::event(QEvent*)
QApplicationPrivate::notify_helper(QObject*, QEvent*)
QApplication::notify(QObject*, QEvent*)
QCoreApplication::notifyInternal2(QObject*, QEvent*)
QShortcutMap::dispatchEvent(QKeyEvent*)
QShortcutMap::tryShortcut(QKeyEvent*)
QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short)
QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*)
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)

g_main_context_dispatch

g_main_context_iteration
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)


Befor that it prints

[seektoTime]  seekToFrame failed for frame at PTS= 24590 ms, next image failed
  [goToTimeVideo]  Cannot seek to beginning of segment 41166416 at  24590 ms


in the console.

QuoteEven trying to set an "A" mark to the beginning and a "B" mark to the end fails.

WFM

QuoteYes, in this simple example I could have set "A" to 00:01.020 and "B" to 00:18.960 but there are more difficult cases. Sometimes I want to cut out several commercial breaks and I don't know how I should do this without deleting parts.

Actually deleting parts always worked for me, but I never had to do this with HD video.

Jan Gruuthuse

Perhaps try other way around:
Quote- Now go to 00:18.960
- Set a "A" mark here, hit "Entf" (cutted out trailing part)
- set mark [A] @ 00:01.020
- cut  "Entf" (00:00:00.00 to 00:00:01.020) is gone now.
- go to 00:18.960
- mark [ B] (assuming you don't want anything beyond 18.960)
- save video (you should now have saved clean part 00:00:00.000 to 00:00:18.960)


see YouTube video demo: Fast Edit with Copy Mode

Jan Gruuthuse

I Think by cutting this way at the end, the reference points no longer match @ the end (idx2 file)
mark [A ] @ 18.960 and cut to the end (the end is no longer defined correctly)


eumagga0x2a

The question is how to handle multiple cuts. I'd test a two-phase strategy: set A where the output should start and B where it should end. Save this to a mkv container as an intermediary step. Now perform further cuts within this mkv.

I do hope that the project owner will look into this crash.

Jan Gruuthuse

#27
QuoteThe question is how to handle multiple cuts
I do these regularly and from the same source (astra 19.2Ã,°E German public broadcast)
Check the youtube video 'Fast Edit with Copy Mode' from previous post.

Quote from: eumagga0x2a on August 04, 2016, 12:59:47 PM
WFM too, despite a couple of warnings

[AudioStream] Warning skew in dts =-633634,
[AudioStream] Warning skew lastDts=00:00:06,140
[AudioStream] Warning skew newDts=00:00:05,506

You might try a rebuild from scratch:
Quote from: mean on August 03, 2016, 03:14:03 PM
1- I have that from time to time, just recompiling *everything* from scratch makes it go away
I suspect mismatched binaries

2- I think it is leaking VDPAU buffer at the moment. After a while, it will crash due to no more buffers

for skew: Delete downloaded avidemux git and download avidemux git new. (1)
Sometimes, power down the PC and start fresh (2)
Don't forget to delete matching .idx2 files.

M-Reimer

#28
I did a full recompile and still have the same problem... Maybe the reason is, that Arch Linux uses always the latest versions? From other projects I know that, for example, FFMPEG breaks their API every few releases...


  [getCompressedPicture]  Frame 19021978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,019
  [getCompressedPicture]  Frame 19041978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,039
  [getCompressedPicture]  Frame 19061978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,059
  [getCompressedPicture]  Frame 19081978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,079
  [getCompressedPicture]  Frame 19101978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,099
  [getCompressedPicture]  Frame 19121978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,119
  [getCompressedPicture]  Frame 19141978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,139
  [getCompressedPicture]  Frame 19161978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,159
  [switchToNextSegment]  This is the last segment (0)
  [getCompressedPicture]  Cannot update to new segment
  [getPacket]   Get packet failed   [saveLoop]  [FF] Wrote 5 frames, nb audio streams 3
  [saveLoop]  [FF] Found 0 missing PTS / 5 total frames
[ffTS] Closing
[~DIA_encodingQt4]  Destroying encoding qt4
  [~DIA_encodingBase]  DiaEncodingBase: Destroying


Edit: I tried to cut the way as described in the Youtube video. This doesn't work either. If I cut something from the start and then just set a "B-Mark" to the end, I still have exactly the same error. *BUT* the error is gone and the result is OK as soon as I move the start one I-Frame to the right. So something seems to be wrong with the start position... In other words: I should be able to do my cutting if I place my first cut one frame to the left, so I'm able to move the mark one to the right for saving. Clearly not the way it was intended, but the only way it works for me... :'(

eumagga0x2a

Quote from: M-Reimer on August 04, 2016, 06:03:09 PM
I did a full recompile and still have the same problem...

This advice applied to me ;)

QuoteFrom other projects I know that, for example, FFMPEG breaks their API every few releases...

Avidemux uses a bundled, heavily patched version of FFmpeg.

Quote
  [getCompressedPicture]  Frame 19021978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,019
  [getCompressedPicture]  Frame 19041978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,039
  [getCompressedPicture]  Frame 19061978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,059
  [getCompressedPicture]  Frame 19081978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,079
  [getCompressedPicture]  Frame 19101978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,099
  [getCompressedPicture]  Frame 19121978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,119
  [getCompressedPicture]  Frame 19141978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,139
  [getCompressedPicture]  Frame 19161978 DTS is going back in time :  [getCompressedPicture]  expected:353:08:30,319   [getCompressedPicture]  got:00:00:19,159
  [switchToNextSegment]  This is the last segment (0)
  [getCompressedPicture]  Cannot update to new segment
  [getPacket]   Get packet failed   [saveLoop]  [FF] Wrote 5 frames, nb audio streams 3
  [saveLoop]  [FF] Found 0 missing PTS / 5 total frames
[ffTS] Closing
[~DIA_encodingQt4]  Destroying encoding qt4
  [~DIA_encodingBase]  DiaEncodingBase: Destroying


Did you try to cut the stream the other (not yours ;)) way?