VideoHelp Forum
+ Reply to Thread
Results 1 to 22 of 22
Thread
  1. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    Hi Guys,

    I have demuxed a DVD using DGIndex and have been trying to mux the m2v video and mp2 audio tracks into an mpeg-ts container using FFmpeg.

    The video and audio track details are:

    General
    Complete name : F:\Temp\V_s01_1.demuxed.m2v
    Format : MPEG Video
    Format version : Version 2
    File size : 1.62 GiB
    Duration : 9mn 42s
    Overall bit rate : 23.9 Mbps

    Video
    Format : MPEG Video
    Format version : Version 2
    Format profile : Main@Main
    Format settings, BVOP : No
    Format settings, Matrix : Default
    Format settings, GOP : M=1, N=12
    Duration : 9mn 42s
    Bit rate mode : Variable
    Bit rate : 22.9 Mbps
    Nominal bit rate : 9 000 Kbps
    Width : 352 pixels
    Height : 288 pixels
    Display aspect ratio : 16:9
    Frame rate : 25.000 fps
    Standard : PAL
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 9.050
    Stream size : 1.56 GiB (96%)

    General
    Complete name : F:\Temp\V_s01_1 Tc0 L2 2ch 48 224 DELAY 0ms.mp2
    Format : MPEG Audio
    File size : 420 MiB
    Duration : 4h 22mn
    Overall bit rate : 224 Kbps

    Audio
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 2
    Duration : 4h 22mn
    Bit rate mode : Constant
    Bit rate : 224 Kbps
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Stream size : 420 MiB (100%)

    Both source files play perfectly using mpc-hc or vlc player, and when both are loaded into GraphStudioNext the resulting playback is smooth and perfectly in sync.

    The FFmpeg command line options that I have been using are as follows:

    ffmpeg -fflags genpts -i "V_S01_1.demuxed.m2v" -i "V_S01_1 Tc0 L2 2ch 48 224 DELAY 0ms.mp2" -vcodec copy -acodec copy -f mpegts -y v_s01_1.ts

    This produces an mpegts file with no error messages during the muxing process.

    ffmpeg version N-56999-g83fc6c8 Copyright (c) 2000-2013 the FFmpeg developers
    built on Oct 9 2013 18:02:04 with gcc 4.8.1 (GCC)

    Input #0, mpegvideo, from 'V_S01_1.demuxed.m2v':
    Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 352x288 [SAR 16:11 DAR 16:9], max. 9000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc
    [mp3 @ 031dd8a0] Estimating duration from bitrate, this may be inaccurate

    Input #1, mp3, from 'V_S01_1 Tc0 L2 2ch 48 224 DELAY 0ms.mp2':
    Duration: 04:22:12.34, start: 0.000000, bitrate: 224 kb/s
    Stream #1:0: Audio: mp2, 48000 Hz, stereo, s16p, 224 kb/s

    Output #0, mpegts, to 'v_s01_1.ts':
    Metadata:
    encoder : Lavf55.19.100
    Stream #0:0: Video: mpeg2video, yuv420p, 352x288 [SAR 16:11 DAR 16:9], q=2-31, max. 9000 kb/s, 25 fps, 90k tbn, 25 tbc
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, 224 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #1:0 -> #0:1 (copy)

    frame=393308 fps=2035 q=-1.0 Lsize= 2362171kB time=04:22:12.36 bitrate=1230.0kbits/s
    video:1700082kB audio:430181kB subtitle:0 global headers:0kB muxing overhead 10.886372%


    The ffmpeg -i "v_s01_1.ts" screen output is:

    Input #0, mpegts, from 'v_s01_1.ts':
    Duration: 04:22:12.30, start: 1.400000, bitrate: 1230 kb/s
    Program 1
    Metadata:
    service_name : Service01
    service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 352x288 [SAR 16:11 DAR 16:9], max. 9000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s

    When "v_s01_1.ts" is played using mpc-hc, jerky, stuttery playback is experienced and it is impossible to seek to any position in the video. The player always becomes unresponsive, and has to be forcibly closed using task manager. A similar problem occurs when the file is loaded into SmartCutter - again impossible to seek to a given position.

    I have tried the "-r", "-ar", "-aspect" and the "-s" options, as it seemed that the container was not providing enough info to the player, but any or all of them did not cure the problem.

    I have tried muxing the two files into a mkv container using MKVtoolnix and the resulting video plays perfectly. However, I would like to find an mpeg solution as SmartCutter does not support matroska and I would like to edit the resulting file without any loss of quality.

    Any help would be greatly appreciated.
    Quote Quote  
  2. I have no idea what the problem is but you might try using TsMuxer instead.
    Quote Quote  
  3. Is transport stream required or will program stream be ok (.mpg) ? Try MPEG2-PS instead

    Are you focused on ffmpeg or willing to try other muxers ? e.g. tsmuxer , tsremux for TS , muxman or imagompeg-muxer for MPEG2-PS

    What was the reason for demuxing it in the first place ?
    Quote Quote  
  4. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    Thanks for reading my post and the prompt replies.

    The reason for demuxing it in the first place was that the source was a non-commercial compilation DVD that included shows that were not required. By demuxing the block of shows that I want to keep, it should be possible to remux the block and then cut it into individual episodes using SmartCutter which performs very well with mpeg-ts.

    I often record TV shows using MediaPortal. In the UK the BBC transmit their programmes using DVB-T which is m2v video and mp2 audio in an mpeg-ts container. These may be played using mpc-hc and edited using SmartCutter without any problems so I am beginning to think that the problem is a lack of meta data in the FFmpeg container.

    I have tried an old version of TsMuxer but get the same poor results as FFmpeg. I have just downloaded an update so I will give it a try latter in the day. I will also try mpeg-ps, but I don't think that it will be quite so compatible with SmartCutter.
    Quote Quote  
  5. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    First suggestion: don't use the option "-fflags genpts", and then see what happens

    2nd suggestion, if the above doesn't work, :

    ffmpeg -i input.m2v -i input.mp2 -vcodec copy -acodec copy
    -mpegts_original_network_id 0x1122
    -mpegts_transport_stream_id 0x3344
    -mpegts_service_id 0x5566
    -mpegts_pmt_start_pid 0x1500
    -mpegts_start_pid 0x150
    -metadata service_provider="whatever01"
    -metadata service_name="whatever02"
    -y output.ts

    { source: http://www.ikeralbeniz.net/2012/05/23/generar-un-ts-transport-stream-valido-para-dvb-t-y-dvb-t2-tdt/ }

    H.T.H.
    Last edited by El Heggunte; 22nd Oct 2013 at 09:32. Reason: edit
    Quote Quote  
  6. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    Ok, I have identified the cause of the problem. Have a look at the attached v_s01_1a.jpg file. This is a graph of v_s01_1.ts being played using some cyberlink external filters in mpc-hc. The upper part of the graph looks sane and would play, but there is an additional unwanted instance of the mp2 audio track in the lower part of the graph. mpc-hc is in fact trying to play two instances of the same audio track! I can confirm that the source ts only contains one video track and one audio track. If the external filters are disabled, things become even more bizarre and an audio switcher gets added to the chain - see attached v_s01_1b.jpg. So it looks as if the player/cutter can't correctly identify what is in the ts container.

    I have also tried the latest version of tsMuxeR and the resulting ts does play in mpc-hc, but I can't seek when using SmartCutter.

    Thanks El Heggunte for the additional FFmpeg options, I will generate a new file and get back to you tomorrow.
    Image Attached Thumbnails Click image for larger version

Name:	v_s01_1a.jpg
Views:	3350
Size:	39.8 KB
ID:	20735  

    Click image for larger version

Name:	v_s01_1b.jpg
Views:	3171
Size:	30.4 KB
ID:	20736  

    Quote Quote  
  7. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    O_o

    BTW, what is the source filter that was being used for demultiplexing the TS file

    Regarding the Cyberlink filters, I use only the MPEG-2 decoder, and configure MPC-HC to block both "Line 21 decoders ".

    P.S.: Also,

    in MPC-HC's Options, Playback, open settings:
    un-tick "Auto-load audio files"
    Last edited by El Heggunte; 22nd Oct 2013 at 13:55. Reason: add P.S.
    Quote Quote  
  8. Originally Posted by w2kpro View Post
    but there is an additional unwanted instance of the mp2 audio track in the lower part of the graph. mpc-hc is in fact trying to play two instances of the same audio track!
    That is a feature of MPCHC. It will play an audio track with the same base name as the video track. You can disable it with View -> Options -> Playback -> Auto-load Audio Files.
    Quote Quote  
  9. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    I think the ts file is being split by mpc-hc's internal filter, but AV Filter is registered on the system. I use the Cyberlink filter because I can adjust the brightness and contrast of the video. The problem is not with mpc-hc's settings or the external filters, as it plays dvb-t ts recordings without any problems.

    I muxed a test clip using the additional parameters and when the ts file was played I got a sane filter graph with no additional mp2 stream. However, if the "-fflags genpts" or "-fflags 1" option is removed, a "set first pts" error occurs. I am not sure what the correct solution to setting "-first_pts" flag is as it requires an Int64 value. Although the new ts file plays using mpc-hc, it can't be edited in SmartCutter. SmartCutter will only load and play the file, but it is not possible to seek to any given position in the clip or frame step, so there is still something fundamentally wrong with the container.

    New command line:

    ffmpeg -fflags genpts -i "v_clip.demuxed.m2v" -i "v_clip Tc0 L2 2ch 48 224 DELAY -160ms.mp2" -vcodec copy -acodec copy -mpegts_original_network_id 0x1122 -mpegts_transport_stream_id 0x3344 -mpegts_service_id 0x5566 -mpegts_pmt_start_pid 0x1500 -mpegts_start_pid 0x150 -metadata service_name="Service01" -metadata service_provider="abc" -metadata service_type="dvb-t" -y v_clip.ts


    If anyone is interested, I am attaching the source test clip mpeg files so we all have the same data.
    Image Attached Files
    Last edited by w2kpro; 23rd Oct 2013 at 06:44. Reason: Batch file did not upload
    Quote Quote  
  10. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Thanks for uploading the sample streams

    First, the bad news
    Over here, ffmpeg indeed needs the switch "-fflags genpts", otherwise it generates a ZERO-byte output

    Now, the good news:
    ffmbc doesn't need the switch "-fflags genpts" , and apparently its output is fully seekable in the portable version of Smart Cutter.
    Quote Quote  
  11. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    UPDATE: this is really weird

    ONLY the ts created through ffmbc is fully "understood" by Smart Cutter

    TS created by ffmpeg = not seekable
    TS created by TSMuxer = idem
    TS created by Elecard XMuxer Pro = idem
    MPG created by TMPGenc Plus = idem

    so my conclusion "must be", Smart Cutter is a VERY-PICKY application

    UPDATE 2: mplex is able to create an MPG that is "friendly" to the not-so-Smart Cutter...

    mplex -v 1 -f 3 -b 256 -O 160ms -V -h -o out.mpg input.m2v input.mp2
    Last edited by El Heggunte; 23rd Oct 2013 at 11:53.
    Quote Quote  
  12. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    Thanks for running the test files. I noticed that SmartCutter has a fix in the options menu for tsMuxeR, so the developers must have identified some problems when muxing to ts. I will try FFmbc and mplex and hopefully will be able to complete the task of producing the separate episodes. A 15 min job has only taken nearly 2 days! As you wrote earlier, it is best to disable the mpc-hc auto loading feature, or mux to a separate folder so that the output ts is separated from the source files. It would be interesting to know why the dvb-t recordings are accepted by SmartCutter, as the dvb-t ts container contains the same spec m2v and mp2 streams. It must be something related to the time stamps, or an inability to correctly determine the length of the video.
    Quote Quote  
  13. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    UPDATE 3: version 2.0.6b of TSmuxer also generates "Smart-Cutter compliant" files

    INFO:

    TS from ffmpeg: 18.6MB

    TS from ffmbc: 18.8MB

    TS from TSmuxer beta: 18.3MB

    It must be something related to the time stamps, or an inability to correctly determine the length of the video.
    I really don't know
    Image Attached Thumbnails Click image for larger version

Name:	smartcutter.png
Views:	575
Size:	220.4 KB
ID:	20771  

    Last edited by El Heggunte; 23rd Oct 2013 at 20:38.
    Quote Quote  
  14. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    I tried FFmbc and mplex and found that most of my muxes worked with SmartCutter (v1.8.4), but a few failed probably due to the poor quality of the source material.

    When using mplex on long clips, an unexpected problem arose in that without the "-M" option, it decides to split the output at the end of sequence markers. It needs a %d in the output file name in order to do this. When running the command line from a DOS batch file, this needs to be something like "output.%%d.mpg".

    There is one other problem remaining, according to DGIndex the "v_clip Tc0 L2 2ch 48 224 DELAY -160ms.mp2" clip has a -160ms delay. Does this mean that for a positive delay the audio lags the video? Perhaps someone could clarify. Also how would the delay be corrected when using either FFmbc or FFmpeg. I have had a go using the following command:

    ffmbc -i "v_clip.demuxed.m2v" -itsoffset -0.16 -i "v_clip Tc0 L2 2ch 48 224 DELAY -160ms.mp2" -vcodec copy -acodec copy -f mpegts "c:\v_clip.ts"

    Does that look sane? 160ms is very small and it is difficult to judge if the video and audio are in perfect sync by looking at the actors lip movements.

    What we need is a more reliable cutter!!
    Last edited by w2kpro; 24th Oct 2013 at 07:00. Reason: Additional comment
    Quote Quote  
  15. Originally Posted by w2kpro View Post
    There is one other problem remaining, according to DGIndex the "v_clip Tc0 L2 2ch 48 224 DELAY -160ms.mp2" clip has a -160ms delay. Does this mean that for a positive delay the audio lags the video?
    A negative delay of the audio advances the audio rather than delaying it. So yes, it's equivalent to delaying the audio by a positive amount instead.
    Quote Quote  
  16. Does that look sane? 160ms is very small and it is difficult to judge if the video and audio are in perfect sync by looking at the actors lip movements.
    160ms is a very perceptible delay if you're listening and watching


    What we need is a more reliable cutter!!
    mpeg2 smart rendering software alternatives to smart cutter include video videoredo, solveigmm video splitter , tmpgenc smart renderer
    Quote Quote  
  17. for MPEG-2 I normally use Cuttermaran
    Quote Quote  
  18. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    I've just tried the trialversion of VideoReDo TvSuite v4.21.3.667 and that works with FFmpeg muxed ts.
    Unfortunately it is 94Mb on disk.
    Quote Quote  
  19. I was actually suggesting videoredo to do everything - cuts, compilation. It's very stable for MPEG2, especially from a DVD MPEG2 program stream. Skip ffmpeg
    Quote Quote  
  20. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    Thanks poisondeathray, I didn't realize VideoReDo could handle elementary streams. I have only been using it for about an hour, so there is going to be a bit of a learning curve. First impressions though are that it is too big and navigation is clumsy compared to Smart Cutter. Smart Cutter has a fine-tune scroll bar to aid rapid location of cut points.

    I demuxed an eight hour long block of video (twelve episodes) from the compilation DVD mentioned above using DGIndex and muxed the m2v and mp2 streams to mpeg-ts using FFmpeg and was surprised to find that it was accepted by Smart Cutter - still does not work with the above short test clips though. Unfortunately when the file was played there was a cumulative out-of-sync problem. By the end of the file the audio was lagging the video by about 300-400ms. So I may have to demux it into several smaller files before creating the final single episodes.
    Quote Quote  
  21. It doesn't handle elementary streams. I was suggesting to use videoredo from the start (no demuxing ) . People have used it for years for unencrypted (or decrypted) DVD sources . It's very stable and reliable for MPEG2, but it's a bit flaky for AVC
    Quote Quote  
  22. Member
    Join Date
    Aug 2011
    Location
    Surrey UK
    Search Comp PM
    According to the help file I think I could use it to load the DVD ifo and remux the episodes straight to .ts or .mpg - looks promising. I also noticed the fine tuning slider; don't know how I missed that the first time around!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!