INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: TV Stuff: JTV --> TS Remuxing  (Read 17737 times)

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
TV Stuff: JTV --> TS Remuxing
« on: October 13, 2016, 05:03:19 pm »

Now Yaobing is bored after nailing the EPG :) I see that users are still struggling with JTV.  I too would like to use JTV but the lack of portability and having no reliable remuxer means I stick to TS. 

Same old request, a "Right Click --> Convert --> JTV to TS" option.  I'm not even sure if this needs to wait for the rework of the whole "Convert Format" profiles as I think all the "bits" are already part of the TV code (eg you can mux a stream to JTV and/or TS now).

Thanks
Nathan
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #1 on: October 13, 2016, 05:49:24 pm »

I would certainly second that. In fact, I may have mentioned it once, or twice, or more previously...

My method of Quickly and easily converting JTV files to a TS file is working fine, but I would like to have it integrated, and supported by JRiver. Also I currently have to open a Windows Explorer session using "Locate>On Disk (external)" first before doing the convert, by right clicking on the file in Explorer and running my batch file. Using the right click "Send To>Send To (external)>[my batch file]" within MC doesn't pass the file name parameter to the batch file correctly, so it doesn't work. I haven't put in the time to resolve why that is the case, since the "Send To (external)" function works for other applications.

However I'm not sure all the components do exist already Jmone. Given that "Convert Format" exists you would think so, but there is no option to remux a file into a new container there. It always converts and saves to one of a limited number of formats, and always with stereo audio. MC basically contains decoders and player components. TS isn't remuxed to JTV or visa versa. Both formats are saved directly from the broadcast stream, in the case of JTV, using a JRiver file writer. It would actually be interesting to see the DirectShow Graph used to write recorded TV broadcasts, for both formats.

It has been suggested that there are licencing issues in saving files with Dolby technology in them. While obviously the TS format can contain Dolby AC3 audio, it just gets saved as broadcast, so there is no "file creation" as such. The file someone else produced is just saved to disk. That would not be the case if say PCM audio in a broadcast was converted to AC3 and saved. That would require Dolby licencing. I would argue, however, that saving someone else's work in a JTV file is fine, as above, and that copying that same content from JTV to TS should also be fine, as there is no conversion happening. The content is just moved from one container format to another, and is identical to the original content, which was the broadcast.

With new formats being broadcast these days, with higher video resolution and better audio, my solution isn't going to keep working for all broadcasts, because it relies on quite old DirectShow filters that won't be updated. It would be nice to have a solution that moves forward with MC.

Maybe Yaobing can comment.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #2 on: October 13, 2016, 06:22:31 pm »

So here is the Filter Graph that is used when playing a live TV Channel.  As you can see, JR already has filters for:
- Demultiplexing the TV Stream
- Writing the desired streams to both JTV ('MJTSWriterFilter') and TS ('JRiver Transport Stream Writer')
- Playing content from both JTV and TS ('JRiver TS Reader Filter' and 'LAV')

.....so the bit (I think) is missing is the logic to connect the existing JTV File Reader part ('JRiver TS Reader Filter' / 'LAV') to one of the existing TS File Writers (either 'MJTSWriterFilter' or the FFMPEG library that is currently used for the Convert Function)

Code: [Select]
Filter Graph Info (Time-shifting writer graph):

    Filter 'MPEG-2 Sections and Tables'
        CLSID: {C666E115-BB62-4027-A113-82D643FE2D99}
        Host: c:\windows\syswow64\mpeg2data.ax
        Input Pin 'In'
            Connected to pin '002' of filter 'MPEG-2 Demultiplexer'
            Major type MEDIATYPE_MPEG2_SECTIONS  Sub type MEDIASUBTYPE_MPEG2DATA, Format type FORMAT_None

    Filter 'MJTSWriterFilter'
        CLSID: {CBE332C2-ED6F-482D-8497-AB51CA0419B7}
        Host: c:\program files (x86)\j river\media center 22\tv\mjtsfilewriter.ax
        Input Pin 'Input'
            Connected to pin '007' of filter 'MPEG-2 Demultiplexer'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx
        Input Pin 'Input'
            Connected to pin '003' of filter 'MPEG-2 Demultiplexer'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO

    Filter 'BDA MPEG2 Transport Information Filter'
        CLSID: {FC772AB0-0C7F-11D3-8FF2-00A0C9224CF4}
        Host: c:\windows\syswow64\psisrndr.ax
        Input Pin 'IB Input'
            Connected to pin '001' of filter 'MPEG-2 Demultiplexer'
            Major type MEDIATYPE_MPEG2_SECTIONS  Sub type MEDIASUBTYPE_DVB_SI, Format type FORMAT_None
        Input Pin 'OOB Input'
        Output Pin 'iTV Out'
        Output Pin 'SBE OUT'

    Filter 'JRiver Transport Stream Writer'
        CLSID: {32147D78-FAF1-4394-A32C-B9BE9004B229}
        Host:
        Input Pin 'Input'
            Connected to pin 'Output1' of filter 'Infinite Tee'
            Major type MEDIATYPE_Stream  Sub type MEDIASUBTYPE_MPEG2_TRANSPORT, Format type TIME_FORMAT_NONE

    Filter 'MPEG-2 Demultiplexer'
        CLSID: {AFB6C280-2C41-11D3-8A60-0000F81E0E4A}
        Host: c:\windows\syswow64\mpg2splt.ax
        Input Pin 'MPEG-2 Stream'
            Connected to pin 'Output2' of filter 'Infinite Tee'
            Major type MEDIATYPE_Stream  Sub type MEDIASUBTYPE_MPEG2_TRANSPORT, Format type TIME_FORMAT_NONE
        Output Pin '001'
            Connected to pin 'IB Input' of filter 'BDA MPEG2 Transport Information Filter'
            Major type MEDIATYPE_MPEG2_SECTIONS  Sub type MEDIASUBTYPE_DVB_SI, Format type FORMAT_None
        Output Pin '002'
            Connected to pin 'In' of filter 'MPEG-2 Sections and Tables'
            Major type MEDIATYPE_MPEG2_SECTIONS  Sub type MEDIASUBTYPE_MPEG2DATA, Format type FORMAT_None
        Output Pin '003'
            Connected to pin 'Input' of filter 'MJTSWriterFilter'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO
        Output Pin '007'
            Connected to pin 'Input' of filter 'MJTSWriterFilter'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx

    Filter 'Infinite Tee'
        CLSID: {F8388A40-D5BB-11D0-BE5A-0080C706568E}
        Host: c:\windows\syswow64\qcap.dll
        Input Pin 'Input'
            Connected to pin 'Output1' of filter 'Silicondust HDHomeRun Tuner 12305581-0 7B8131C210CECAD9'
            Major type MEDIATYPE_Stream  Sub type MEDIASUBTYPE_MPEG2_TRANSPORT, Format type TIME_FORMAT_NONE
        Output Pin 'Output1'
            Connected to pin 'Input' of filter 'JRiver Transport Stream Writer'
            Major type MEDIATYPE_Stream  Sub type MEDIASUBTYPE_MPEG2_TRANSPORT, Format type TIME_FORMAT_NONE
        Output Pin 'Output2'
            Connected to pin 'MPEG-2 Stream' of filter 'MPEG-2 Demultiplexer'
            Major type MEDIATYPE_Stream  Sub type MEDIASUBTYPE_MPEG2_TRANSPORT, Format type TIME_FORMAT_NONE
        Output Pin 'Output3'

    Filter 'Silicondust HDHomeRun Tuner 12305581-0 7B8131C210CECAD9'
        CLSID: {335188BB-12AC-4C5B-B1BC-3EEF83FB01A3}
        Host: c:\program files\silicondust\hdhomerun\hdhomerun_bda_x86.ax
        Input Pin 'Input0'
            Connected to pin 'Antenna Out' of filter 'Network Provider'
            Major type TIME_FORMAT_NONE  Sub type TIME_FORMAT_NONE, Format type TIME_FORMAT_NONE
        Output Pin 'Output1'
            Connected to pin 'Input' of filter 'Infinite Tee'
            Major type TIME_FORMAT_NONE  Sub type TIME_FORMAT_NONE, Format type TIME_FORMAT_NONE

    Filter 'Network Provider'
        CLSID: {B2F3A67C-29DA-4C78-8831-091ED509A475}
        Host: c:\windows\syswow64\msnp.ax
        Output Pin 'Antenna Out'
            Connected to pin 'Input0' of filter 'Silicondust HDHomeRun Tuner 12305581-0 7B8131C210CECAD9'
            Major type Unknown GUID Name: {71985F41-1CA1-11D3-9CC8-00C04F7971E0}  Sub type MEDIASUBTYPE_None, Format type TIME_FORMAT_NONE
_________________________________________________________________________

Filter Graph Info (Time-shifting player graph):

    Filter 'JRiver Audio Renderer'
        CLSID: {A4002F8E-510F-442C-8AD3-F9C7B23FB394}
        Host:
        Input Pin 'In'
            Connected to pin 'Output' of filter 'LAV Audio Decoder (auto-configured)'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_IEEE_FLOAT, Format type FORMAT_WaveFormatEx

    Filter 'madVR'
        CLSID: {E1A8B82A-32CE-4B0D-BE0D-AA68C772E423}
        Host: C:\Users\natha\AppData\Roaming\J River\Media Center 22\Plugins\madvr\madvr.ax
        Input Pin 'Input'
            Connected to pin 'Output' of filter 'LAV Video Decoder (auto-configured)'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_NV12, Format type FORMAT_VideoInfo2

    Filter 'LAV Video Decoder (auto-configured)'
        CLSID: {EE30215D-164F-4A92-A4EB-9D4C13390F9F}
        Host: C:\Users\natha\AppData\Roaming\J River\Media Center 22\Plugins\lav\LAVVideo.ax
        Input Pin 'Input'
            Connected to pin 'Output' of filter 'JRiver Video Monitor'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO
        Output Pin 'Output'
            Connected to pin 'Input' of filter 'madVR'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_NV12, Format type FORMAT_VideoInfo2

    Filter 'LAV Audio Decoder (auto-configured)'
        CLSID: {E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491}
        Host: C:\Users\natha\AppData\Roaming\J River\Media Center 22\Plugins\lav\LAVAudio.ax
        Input Pin 'Input'
            Connected to pin 'Output' of filter 'JRiver Audio Monitor'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx
        Output Pin 'Output'
            Connected to pin 'In' of filter 'JRiver Audio Renderer'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_IEEE_FLOAT, Format type FORMAT_WaveFormatEx

    Filter 'JRiver Video Monitor'
        CLSID: {A4207487-E7D8-406B-9882-B66370DE2492}
        Host:
        Input Pin 'Input'
            Connected to pin 'Video Output' of filter 'JRiver TS Reader Filter'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO
        Output Pin 'Output'
            Connected to pin 'Input' of filter 'LAV Video Decoder (auto-configured)'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO

    Filter 'JRiver Audio Monitor'
        CLSID: {A4207487-E7D8-406B-9882-B66370DE2492}
        Host:
        Input Pin 'Input'
            Connected to pin 'Audio Output' of filter 'JRiver TS Reader Filter'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx
        Output Pin 'Output'
            Connected to pin 'Input' of filter 'LAV Audio Decoder (auto-configured)'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx

    Filter 'JRiver TS Reader Filter'
        CLSID: {8303B00A-D9E3-4BD7-A79A-AD7077F54123}
        Host: c:\program files (x86)\j river\media center 22\tv\mjtsfilereader.ax
        Output Pin 'Audio Output'
            Connected to pin 'Input' of filter 'JRiver Audio Monitor'
            Major type MEDIATYPE_Audio  Sub type MEDIASUBTYPE_MPEG2_AUDIO, Format type FORMAT_WaveFormatEx
        Output Pin 'Video Output'
            Connected to pin 'Input' of filter 'JRiver Video Monitor'
            Major type MEDIATYPE_Video  Sub type MEDIASUBTYPE_MPEG2_VIDEO, Format type FORMAT_MPEG2_VIDEO
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #3 on: October 13, 2016, 06:35:33 pm »

I've tried to use the JRiver filters before but always got stuck on finding the TS Writer as it does not have a DLL exposed (Host is empty)

    Filter 'JRiver Transport Stream Writer'
        CLSID: {32147D78-FAF1-4394-A32C-B9BE9004B229}
        Host:
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #4 on: October 13, 2016, 07:40:38 pm »

I can clearly see that the TS file creation is straight forward with no real processing, including no demultiplexing:
Network Provider > Tuner > Infinite Tree (split input into two streams, one for TS, one for JTV, plus two information streams I'll ignore in this discussion);

      Stream Copy 1: > Write TS file (There is no demultiplexing or multiplexing happening. This is a combined audio and video stream.)

      Stream Copy 2: > Demultiplex Audio and Video > Write JTV files

So I don't see any Multiplexing filter in that graph, which is of course the missing part if one wishes to multiplex JTV files back together and save them to a file. The JTV player doesn't multiplex the audio and video streams together either. It just processes each stream separately. The process in my solution does the following:

Read JTV files > Multiplex Audio and Video from JTV files > Write TS file.

I believe it is the multiplexing of audio and video streams that is the stumbling block, probably for the reason mentioned above. The "Convert Format" function obviously must multiplex the audio and video streams together after processing, but it is in that tool that the output options are limited.

I note also that this is an MEPG2 broadcast stream example. We now have a few H.264 broadcast channels in Australia, so any multiplexer also needs to handle the video and audio formats found in those recordings, such as 1440x1080i video and 6 channel AAC and AC3 audio. I would assume, based on its name, that "Infinite Tee" is used to direct the stream to the correct demultiplexer for creating JTV files.


BTW, how are you collecting the DirectShow Graph for the recording process? I just right click on a playing video > "DirectShow Filters > Copy graph info to clipboard" to get the playback graph, but I don't know how to get the recording graph. Care to share?
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Yaobing

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10926
  • Dogs of the world unite!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #5 on: October 13, 2016, 07:41:43 pm »

That TS Writer is not exposed (it is totally internal).  It is not suitable for remuxing though, without a multiplexer filter.  That is the part that is missing.
Logged
Yaobing Deng, JRiver Media Center

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #6 on: October 13, 2016, 08:36:16 pm »

Thanks Yaobing. That explains why I couldn't find any evidence of it anywhere.  8)

You have confirmed my thoughts as well regarding the missing piece.

Neither LAV nor madVR are going to have a multiplexer. I searched quite a bit for a suitable free DirectShow Filter multiplexer, but only found the two mentioned in my solution. I suspect there is a third on my HTPC now since I have installed a NVidia card, but haven't looked. I couldn't find anything useful in FFMPEG, or on Videohelp.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #7 on: October 13, 2016, 11:39:59 pm »

Right ... so no Direct Show multiplexer filter in MC  :( - next try using FFMPEG/avcodec that the Convert function uses).

So I had more of a play with both a AVC/AC-3 and a MPEG2/MPEG Audio JTV File:
- Demuxed the JTV files to their Video and Audio Streams using the MJTSFileReader + Dump Filter = No Issues
- Remuxing to a TS file using tsMuxeR = Both worked but had audio out of sync

I then had a play using FFMPEG and I'm certainly no expert with the various switches and found using "ffmpeg -fflags +genpts -i Video1 -i Audio1 -c copy test.ts"
- MPEG2/MPEG Audio = Muxed fine but audio out of sync as with tsMuxeR (Results as follows)
Code: [Select]
M:\Video Editing\transcodes\ffmpeg\bin>ffmpeg -fflags +genpts -i Video1 -i Audio1 -c copy test.ts
ffmpeg version N-81982-g7cf0ed3 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheor
a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --ena
ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 61.103 / 57. 61.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
[mpeg1video @ 03b1c260] Invalid frame dimensions 0x0.
    Last message repeated 12 times
Input #0, mpegvideo, from 'Video1':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 20.33 fps, 25 tbr, 1200k tbn, 50 tbc
[mp3 @ 0528cba0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'Audio1':
  Duration: 00:01:01.68, start: 0.000000, bitrate: 256 kb/s
    Stream #1:0: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf57.52.100
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 20.33 fps, 25 tbr, 90k tbn, 1200k tbc
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, 256 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1531 fps=0.0 q=-1.0 Lsize=   33029kB time=00:01:02.28 bitrate=4344.4kbits/s speed= 855x
video:28459kB audio:1928kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.695177%

M:\Video Editing\transcodes\ffmpeg\bin>pause
Press any key to continue . . .
- AVC/AC-3 = Error (Results as follows)
Code: [Select]
M:\Video Editing\transcodes\ffmpeg\bin>ffmpeg -fflags +genpts -i Video -i Audio -c copy test.ts
ffmpeg version N-81982-g7cf0ed3 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheor
a --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --ena
ble-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 61.103 / 57. 61.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0332c260] non-existing SPS 0 referenced in buffering period
[h264 @ 0332c260] SPS unavailable in decode_picture_timing
[h264 @ 0332c260] non-existing PPS 0 referenced
[h264 @ 0332c260] non-existing SPS 0 referenced in buffering period
[h264 @ 0332c260] SPS unavailable in decode_picture_timing
[h264 @ 0332c260] non-existing PPS 0 referenced
[h264 @ 0332c260] decode_slice_header error
[h264 @ 0332c260] no frame!
Input #0, h264, from 'Video':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
[ac3 @ 05447680] Estimating duration from bitrate, this may be inaccurate
Input #1, ac3, from 'Audio':
  Duration: 00:01:54.71, start: 0.000000, bitrate: 447 kb/s
    Stream #1:0: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf57.52.100
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 1200k tbc
    Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0550a6e0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps p
roperly
[mpegts @ 0550a6e0] first pts value must be set
av_interleaved_write_frame(): Invalid data found when processing input
frame=    1 fps=0.0 q=-1.0 Lsize=       2kB time=00:00:00.00 bitrate=N/A speed=   0x
video:107kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

M:\Video Editing\transcodes\ffmpeg\bin>pause
Press any key to continue . . .
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #8 on: October 13, 2016, 11:42:35 pm »

Anyway, we do have a TS Muxer in MC, the same one used for the Convert Function and I understand you can programmatically feed avcodec (FFMPEG) with the streams so you don't have to manually demux first.... just not a working profile!

So if anyone has any hints on the FFMPEG switches to:
- mux the JTV extracted AVC/AC-3 streams to a TS container, and
- How to adjust the sync
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #9 on: October 13, 2016, 11:43:29 pm »

Quote
BTW, how are you collecting the DirectShow Graph for the recording process? I just right click on a playing video > "DirectShow Filters > Copy graph info to clipboard" to get the playback graph, but I don't know how to get the recording graph. Care to share?

Same as you with "right click on a playing video > "DirectShow Filters > Copy graph info to clipboard"
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #10 on: October 14, 2016, 05:38:08 pm »

Same as you with "right click on a playing video > "DirectShow Filters > Copy graph info to clipboard"

Ah ha! I guess I had never tried that while playing live TV before. I see it works fine for me also. Ta.  :D

- Demuxed the JTV files to their Video and Audio Streams using the MJTSFileReader + Dump Filter = No Issues

So you just dumped the elementary streams pulled out of the JTV files into a file? What format file? Regardless, I think this is where you lost audio sync, which was then carried forward into your use of tsMuxeR and FFMPEG. I suspect that you would have to work out the offset you needed to adjust by, and then apply that offset when you muxed using any tool later.

As far as I could work out, there was no tool that would use the JRiver MJTSFileReader DirectShow filter to open the elementary streams, and then complete the process in one go. Neither FFMPEG nor tsMuxeR could use the DirectShow filter. There was some work for FFMPEG to use a DirectShow filter, but it was limited and didn't seem to work for a lot of people.

So, if I understand correctly, you now have a two step process;
1. Dump the JTV format to an elementary stream format in a file.
2. Remux the elementary streams using some other tool.

That would still leave you with a TS file which is the same situation my more or less one step process achieves. I have to import the new version, or MC does since I save it in the same directory as the original. I have to migrate metadata, which is a pain for TV series, but not so bad for movies. I have to delete the original version.

I think I will stick with my one step process for now. If you can work out how to feed the streams into the muxer included in MC, and output a TS file, please share. I don't have enough knowledge about FFMPEG or programming, or the Profile system used by the internal Convert Function to work out how to do that. As I have said before, since it is just a remux and not a conversion, I think it would be easy for JRiver to do, but it hasn't been done.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #11 on: October 14, 2016, 06:39:48 pm »

I'm not trying to get an external process working.... more trying to "encourage" JR to use the existing MC platform to add the special case of JTV --> TS muxing for now (I know that Hendrik has commented previously that he would like to see a more flexible Convert Function instead of just the fixed profiles we have)
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #12 on: October 14, 2016, 06:46:16 pm »

...and I should say I don't care what method is used:
- Create a TS Muxer and use DirectShow filters
- Add the JTV File Type to the FFDSHOW Trunk
- Demux with the JTVDemuxer and feed to avlib
- Magic

The issue has been around since JTV was invented and since TV has some focus I thought it worth raising again.  Simply, it would be a good one to knock off the to do list, as there are regular posts on how to do this... and it should be a part of MC.
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #13 on: October 14, 2016, 06:55:35 pm »

Yeah I hear you, and I am glad of your voice next to mine. I guess I have just become hoarse with asking, which is why I built my own.

JTV is a far better format for recording, and I'm sure many more people would use it if there was a simple way to convert recordings which we want to keep for some time to a better archival format. Remuxing to TS allows the use of our own favourite video editor later in the workflow without loss of quality, which is why I pursued that method. Not to mention that it is so fast that it makes the task of archiving programs realistic, instead of being too much of a pain to bother.

So, keep shouting. I'm right beside you!  8)
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: TV Stuff: JTV --> TS Remuxing
« Reply #14 on: October 14, 2016, 07:10:44 pm »

Aussies (make a lot of trouble)
Logged

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #15 on: October 14, 2016, 08:08:09 pm »

Fixed your post, you were being too kind  ;D
Logged
JRiver CEO Elect

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251
Re: TV Stuff: JTV --> TS Remuxing
« Reply #16 on: October 14, 2016, 09:00:15 pm »

Yeah I hear you, and I am glad of your voice next to mine. I guess I have just become hoarse with asking, which is why I built my own.

JTV is a far better format for recording, and I'm sure many more people would use it if there was a simple way to convert recordings which we want to keep for some time to a better archival format. Remuxing to TS allows the use of our own favourite video editor later in the workflow without loss of quality, which is why I pursued that method. Not to mention that it is so fast that it makes the task of archiving programs realistic, instead of being too much of a pain to bother.

So, keep shouting. I'm right beside you!  8)

I like your Aussie sense of roll up your sleeves and fashion your own fix Rod. Very stump jump plough and refrigerator of you. Geez, the original Aussies (arguably) even invented the aerofoil.

Anyway, I've had a look at your method for .jtv to .ts conversion and kudos to you for your industry. I'd prefer to see an MC internal solution for that one, so, add my voice to the list.
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #17 on: October 14, 2016, 11:09:54 pm »

Aussies (make a lot of trouble)

Fixed your post, you were being too kind  ;D

We may make a lot of trouble, but we do it in a nice way, and it is the good sort of trouble. Like sending a bunch of Chickens to a friend.


Thanks Astromo. Necessity is the mother of invention.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #18 on: October 15, 2016, 03:29:31 am »

Don't listen to Jim!  He has been editing history again  ;D ...and my sig block I see!
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #19 on: October 15, 2016, 03:55:11 am »

Ah, so he is a revisionist, as well as a dictator!  :o
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: TV Stuff: JTV --> TS Remuxing
« Reply #20 on: October 15, 2016, 07:54:27 am »

We've been hacked.  The only thing missing is the TV code for Australia.
Logged

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251
Re: TV Stuff: JTV --> TS Remuxing
« Reply #21 on: October 15, 2016, 11:22:19 am »

We've been hacked.  The only thing missing is the TV code for Australia.

But at least you get an avatar that's bonza mate...  ;)
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #22 on: October 15, 2016, 02:20:06 pm »

But at least you get an avatar that's bonza mate...  ;)

 8)
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #23 on: October 15, 2016, 03:36:47 pm »

Rod (or others), do you want to try the attached?  I've created a compiled version of your DirectShow filter idea (using MJTSReaderFilter, ElecardMPEGMultiplexer, and the ElecardSinkFilter) with C# (let me know if you want the code). 
- Just unzip the two files in a folder of your choice (JTVtoTS.exe and DirectShow.dll)
- Either Drag/Drop a JTV file on the JTVtoTS.exe or use MC's Send To External Feature
- It should then create a TS remux with the same name in the same folder
- You need to have the Elecard filters registered

To create a MC Send To "JTVtoTS" (see pic)
- RightClick --> Send To --> Send To (External) --> Add Edit Programs... --> Add..
- Then Enter in the Following and press OK
   Name: JTVtoTS
   Program Path: thefolderpathto\JTVtoTS.exe
   Parameters: "[Filename]"

You can now just select a JTV File and RightClick --> Send To --> Send To (External) --> JTVtoTS (and once run it will be in your Recent Commands List).

If it works I could also make a little Install Prog that would:
- Download and register the filters
- Add the JTVtoTS Send To cmd in MC.

Thanks
Nathan
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #24 on: October 15, 2016, 05:11:53 pm »

Thanks Nathan.

I will definitely try that, but not today I'm afraid. It's MotoGP day today. Japan this week. So most of my day is committed to boozing, eating, chin wagging, and yelling at the TV with a bunch of mates.  ;D

You have produced what I can't produce, because I haven't coded anything in a long time, and it would take me ages to work out where to start. Much appreciated. Let's just hope the Elecard Multiplexer can handle everything our broadcasters throw at us. I have only seen one remux that wouldn't work so far, with the audio dropped from the TS file. That may have been an anomaly, but I check the output file every time before deleting the original because of it.

I shall report how it went tomorrow though. Once I get over the MotoGP !
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #25 on: October 15, 2016, 06:43:39 pm »

Have fun - It's just a V1 of some hacked together code (my first time using VS and C# so I've really have no idea what I'm doing but it does seem to work)
Logged
JRiver CEO Elect

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251
Re: TV Stuff: JTV --> TS Remuxing
« Reply #26 on: October 16, 2016, 05:09:03 am »

Nice one.

I'll give this a bash when I get the chance. Thanks.
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #27 on: October 16, 2016, 06:45:17 am »

Okay, I found some time to take a look at this tonight.

I tested using both the drag and drop method, and the Send To external program method. Both have worked fine so far. I need to test it on a broader range of recording types though, including six channel audio in AC3 and AAC format, which was where I had trouble before.

Yes, I think an installation program would be good once we have tested a bit more.

Yes, I would like to see the source code, just so I can learn a bit about how to do this stuff easily, or at least how you did it. Thanks.

I did have to tell my Norton 360 antivirus to let it run, both on drag and drop and Send To methods. So far every time Norton has objected, so I will probably have to put a special rule in Norton to leave it alone.

Also, because I installed it under the directory "C:\Program Files (x86)\JTVtoTS", when I dragged a JTV file onto the executable Windows 10 objected stating something was trying to change the system. Something to avoid for any technically challenged users. I will be using the Send To method myself nearly always anyway.

I'm just experimenting with the right click "Edit Commands" in MC to Copy tags from the JTV files and Paste them to the TS files. I haven't used that before but it seems to work okay, and speeds up the process for TV Series. Otherwise the metadata management can be a pain. I have mostly used my original method on recorded movies up to now, and just to clear out disk space on my recording disk, and make it easier to move them to a movie disk with structured directories. But I have some TV Series that I want to convert, save, and move as well, so the metadata management is important.

Anyway, well done. Version 1.0 seems to work fine. I shall use this from now on, and test on more recordings.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #28 on: October 16, 2016, 02:49:40 pm »

Thanks for testing and I'm glad it works on a different rig!  FYI - this method builds a new graph based on each input file every time.... so it should be pretty robust in it's output or just fail to build.  Worked so far with
- HD AVC/AC3 (6Ch)
- SD Mpeg2/Mpeg Audio. 

I did find that the "Racing" ch uses a sub SD stream including a 2ch AAC_Latm and these do not remux (error is that the Elecard MPEG Multiplexer refuses to accept the pin from MJTSReader 'There is no common media type between these pins'), so looks like the muxer does not like AAC_Latm (but ?? on AAC).  Are there any other combos you found?

I used GraphEditPlus to build the Filter Chain as you outlined.  While GraphEditPlus is payware and older, it has a "Generate Code" feature that can spit out C++ or C#.  I could not get the C++ code working in VS2015 (much of the code seems to have been depricated), the C# was pretty staight forward.  Had to modify a couple of Arguments for the filenames and all good.

Pending how I go, I'd like to wrap it in Autohotkey Script as I just don't know anything about C but lets see how the current compile goes.... (of course the JR folk are probably laughing at this and could knock up a real solution quickly)

Code: [Select]
//Don't forget to add reference to DirectShowLib in your project.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices;
using DirectShowLib;

namespace graphcode
{
    class Program
    {
        static void checkHR(int hr, string msg)
        {
            if (hr < 0)
            {
                Console.WriteLine(msg);
                DsError.ThrowExceptionForHR(hr);
            }
        }

        static void BuildGraph(IGraphBuilder pGraph, string srcFile1, string dstFile1)
        {
            int hr = 0;

            //graph builder
            ICaptureGraphBuilder2 pBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
            hr = pBuilder.SetFiltergraph(pGraph);
            checkHR(hr, "Can't SetFiltergraph");

            Guid CLSID_MJTSReaderFilter = new Guid("{8303B00A-D9E3-4BD7-A79A-AD7077F54123}"); //MJTSFileReader.ax
            Guid CLSID_ElecardMPEGMultiplexer = new Guid("{0FD7F9F6-747D-46CF-AC0B-FA9DAE4F6299}"); //empegmux.ax
            Guid CLSID_ElecardSinkFilter = new Guid("{CF2521A7-4029-4CC1-8C6E-F82BD82BB343}"); //ESF.ax

            //add MJTSReaderFilter
            IBaseFilter pMJTSReaderFilter = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_MJTSReaderFilter));
            hr = pGraph.AddFilter(pMJTSReaderFilter, "MJTSReaderFilter");
            checkHR(hr, "Can't add MJTSReaderFilter to graph");
            //set source filename
            IFileSourceFilter pMJTSReaderFilter_src = pMJTSReaderFilter as IFileSourceFilter;
            if (pMJTSReaderFilter_src == null)
                checkHR(unchecked((int)0x80004002), "Can't get IFileSourceFilter");
            hr = pMJTSReaderFilter_src.Load(srcFile1, null);
            checkHR(hr, "Can't load file");

            //add Elecard MPEG Multiplexer
            IBaseFilter pElecardMPEGMultiplexer = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_ElecardMPEGMultiplexer));
            hr = pGraph.AddFilter(pElecardMPEGMultiplexer, "Elecard MPEG Multiplexer");
            checkHR(hr, "Can't add Elecard MPEG Multiplexer to graph");

            //connect MJTSReaderFilter and Elecard MPEG Multiplexer
            hr = pGraph.ConnectDirect(GetPin(pMJTSReaderFilter, "Audio Output"), GetPin(pElecardMPEGMultiplexer, "Input #0"), null);
            checkHR(hr, "Can't connect MJTSReaderFilter and Elecard MPEG Multiplexer");

            //connect MJTSReaderFilter and Elecard MPEG Multiplexer
            hr = pGraph.ConnectDirect(GetPin(pMJTSReaderFilter, "Video Output"), GetPin(pElecardMPEGMultiplexer, "Input #1"), null);
            checkHR(hr, "Can't connect MJTSReaderFilter and Elecard MPEG Multiplexer");

            //add Elecard Sink Filter
            IBaseFilter pElecardSinkFilter = (IBaseFilter)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_ElecardSinkFilter));
            hr = pGraph.AddFilter(pElecardSinkFilter, "Elecard Sink Filter");
            checkHR(hr, "Can't add Elecard Sink Filter to graph");
            //set destination filename
            IFileSinkFilter pElecardSinkFilter_sink = pElecardSinkFilter as IFileSinkFilter;
            if (pElecardSinkFilter_sink == null)
                checkHR(unchecked((int)0x80004002), "Can't get IFileSinkFilter");
            hr = pElecardSinkFilter_sink.SetFileName(dstFile1, null);
            checkHR(hr, "Can't set filename");

            //connect Elecard MPEG Multiplexer and Elecard Sink Filter
            hr = pGraph.ConnectDirect(GetPin(pElecardMPEGMultiplexer, "Output"), GetPin(pElecardSinkFilter, "Input"), null);
            checkHR(hr, "Can't connect Elecard MPEG Multiplexer and Elecard Sink Filter");
        }

        static void Main(string[] args)
        {
            try
            {
                string outfilename = args[0].Replace(".jtv", ".ts");
                IGraphBuilder graph = (IGraphBuilder)new FilterGraph();
                Console.WriteLine("Building graph...");
                BuildGraph(graph, args[0], outfilename);
                Console.WriteLine("Running...");
                IMediaControl mediaControl = (IMediaControl)graph;
                IMediaEvent mediaEvent = (IMediaEvent)graph;
                int hr = mediaControl.Run();
                checkHR(hr, "Can't run the graph");
                bool stop = false;
                while (!stop)
                {
                    System.Threading.Thread.Sleep(500);
                    Console.Write(".");
                    EventCode ev;
                    IntPtr p1, p2;
                    System.Windows.Forms.Application.DoEvents();
                    while (mediaEvent.GetEvent(out ev, out p1, out p2, 0) == 0)
                    {
                        if (ev == EventCode.Complete || ev == EventCode.UserAbort)
                        {
                            Console.WriteLine("Done!");
                            stop = true;
                        }
                        else
                        if (ev == EventCode.ErrorAbort)
                        {
                            Console.WriteLine("An error occured: HRESULT={0:X}", p1);
                            mediaControl.Stop();
                            stop = true;
                        }
                        mediaEvent.FreeEventParams(ev, p1, p2);
                    }
                }
            }
            catch (COMException ex)
            {
                Console.WriteLine("COM error: " + ex.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.ToString());
            }
        }
        static IPin GetPin(IBaseFilter filter, string pinname)
        {
            IEnumPins epins;
            int hr = filter.EnumPins(out epins);
            checkHR(hr, "Can't enumerate pins");
            IntPtr fetched = Marshal.AllocCoTaskMem(4);
            IPin[] pins = new IPin[1];
            while (epins.Next(1, pins, fetched) == 0)
            {
                PinInfo pinfo;
                pins[0].QueryPinInfo(out pinfo);
                bool found = (pinfo.name == pinname);
                DsUtils.FreePinInfo(pinfo);
                if (found)
                    return pins[0];
            }
            checkHR(-1, "Pin not found");
            return null;

        }

    }

}
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #29 on: October 16, 2016, 04:04:16 pm »

If I do wrap it in AHK, I can then easily do the Meta Data mgt side via MCWS such as:
- Import the TS version (delete the JTV if wanted)
- Copy the Meta Data from the JTV to the TS etc

.... still all of this can be done with the MC's existing Convert Function..... if it supported remuxing JTV that is!
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #30 on: October 16, 2016, 05:33:20 pm »

I looked at GraphEditPlus and thought about doing what you have done, but I just don't have the programming skills. I should learn some. I can read and understand most of the code, except for some of the functions, but I couldn't write it, or fix what GraphEditPlus created. So once again well done.

I think the problem broadcast I had also had an unusual variation of the AAC format. Maybe it was AAC_Latm. I remember googling the format and not getting a clear picture of the difference. That was frustrating because MC played the recordings, but registered the audio as "unknown Audio". There was also one sample that MC registered as "unknown video". I'll have to go back and see what I can find.

By the way just for giggles I tried selecting two recordings and sending them both to JTVtoTS. It worked, but it was much slower. I think it took longer than doing the two separately would have. But handy if I wanted to convert a bunch of files unattended. Two command windows popped up when I did this, and progressed through their files. I would guess MC handled launching JTVtoTS for each file, and sending the recorded file info to each.

I'm not sure if the console command window visibility is a good thing or not, but I guess it shows progress is still happening. Graph Studio Next didn't provide much better feedback than your console display.

Finally I don't use AutoHotKey at the moment, but if it could automate the steps after the remixing, that would probably be good. I wouldn't delete the original recording until I had tested the TS file, but as long as that was optional that would be fine. I do usually trim all padding from the beginning and end of the recordings, and sometimes go through and cut out commercials. That is all be done separately to this process though, in VideoReDo.

We need keep saying this:
.... still all of this can be done with the MC's existing Convert Function..... if it supported remuxing JTV that is!

I'm going to get my knuckles rapped, aren't I?!
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #31 on: October 16, 2016, 06:13:05 pm »

 ;D you will get in trouble!

- If I use a AHK script to call the JTVtoTS.exe then I can both hid the Console and also still get the info from it for a log file (for what it is worth)
- The SendTo command will launch multiple instances in parallel (in AHK I can suppress this which I do with the other scripts so only one runs at a time)

...anyway, I will not have a chance to look at it till the weekend but it is worth making sure the core conversion works before adding the pretty stuff around it.
Logged
JRiver CEO Elect

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #32 on: October 16, 2016, 06:41:54 pm »

...I'm sure Hendrik is reading this thread with amusement  ;D
Logged
JRiver CEO Elect

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: TV Stuff: JTV --> TS Remuxing
« Reply #33 on: October 16, 2016, 07:09:14 pm »

Doubtful
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10933
Re: TV Stuff: JTV --> TS Remuxing
« Reply #34 on: October 17, 2016, 04:43:34 am »

I'm always amused when them aussies do things upside down! :D

Complete remuxing for everything is a complex topic, because there is so many different combinations and conditions that are not always all possible, but a limited case from jtv to ts, where we already know the original content used to fit in ts (since thats what it broadcasts as), wouldn't be that hard. But the entire convert function is designed to decode and encode first right now, so for remuxing we would probably have to make a spin-off of that, which takes the data and just writes it out again.

Anyhow I'm busy for a while to come, maybe next year.
Logged
~ nevcairiel
~ Author of LAV Filters

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: TV Stuff: JTV --> TS Remuxing
« Reply #35 on: October 17, 2016, 05:53:27 am »

 ;D That is what I thought.  You must laugh at times (or shake your head) with the convoluted effort users go through. 

As you say it is an original TS broadcast with the streams optionally muxed in JTV (instead of TS)... but here we are trying to get the streams in the JTV back into a TS container:
.... using random DirectShow Filters
.... then invoking the graph using C#
.... and now talking about wrapping it in a scripting language to make it "pretty"
....+ it still does not like some of the Audio/Video combos from the original broadcast!!! 

Nuts right (but oddly fun!), even if it makes no sense....If you would like to confirm you address, I'll get those Chickens on the way!  :o
Logged
JRiver CEO Elect

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #36 on: October 17, 2016, 04:52:11 pm »

Anyhow I'm busy for a while to come, maybe next year.

Well that's only 11 weeks away, so no problem really.  ;D




Don't talk about how close Christmas is though...
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: TV Stuff: JTV --> TS Remuxing
« Reply #37 on: October 17, 2016, 07:38:40 pm »

....+ it still does not like some of the Audio/Video combos from the original broadcast!!! 

Just on that topic, I found the recorded movie (Valkyrie) I mentioned earlier that would not remux with audio for me. It was recorded on March 9th, 2016 from Channel 76 7flix, when that channel was still in its earliest incarnation, and was broadcasting some weird formats. From memory back then it was supposed to be HD, but this movie is 720x576 25fps PAL AVC with format profile Main@L3.1. It does have the aforementioned AAC LATM 2 channel audio, which is shown in the MC [Compression] tag as an "audio: unknown codec". MC says the video is h.264, which is strange for a 720x576 video I would have thought. Using my remux method resulted in a TS file with no audio. Using your method errors out, but I can't see the messages displayed in the console, so I don't know what is going wrong. I assume it is the same as you reported for the Racing channel above, 'There is no common media type between these pins'.

I still have the original channel information in MC, and it shows that it was supposed to be AVC1/H.264 Video, AAC LATM Audio, as was the now defunct "74 TV4ME" and the still running "78 Racing.com", which is now broadcasting the weird format of 640x576 interlaced (I think, padded on the sides to 720x576 maybe, to produce a 16:9 display), 25fps, AVC Main@L3.0, AAC LATM, according to MediaInfo, unknown video codec and unknown audio codec in MC.

Anyway, that seems to have all been a failed experiment by Channel 7, and channel 76 has since been updated and is now broadcasting as "76 7flix Melbourne" with MPEG-1 audio and MPEG-2 video, so it is no longer a problem. I certainly don't care about the weird channel 78.

However, searching for "unknown codec" among my recordings still in JTV format I see the all the new HD channels (70 7HD Melbourne, 90 9HD Melbourne, 13 TEN HD) have broadcast some shows in 1920x1080 rather than the usual 1440x1080i format. At least some of the 1920x1080 recordings show video as unknown codec. There doesn't seem to be anything special about them. Below is the MediaInfo output for one example:
Code: [Select]
General
Complete name                            : \\WILMA\Recorded TV\NCIS_ New Orleans\NCIS_ New Orleans - S02E20 - Second Line\NCIS_ New Orleans - S02E20 - Second Line-0.jts.cnk
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 176 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Color range                              : Limited


Actually, it looks like maybe all those HD channels are now broadcasting everything in 1920x1080i format. Or at least everything I have recorded.

Searching my existing recordings for those channels I find that MC only recognises the video as h.264 for "Limitless" broadcast on "13 TEN HD", and no other recordings on TEN HD or other channels. Maybe my sample is small, but that seems a little strange. Particularly as reports the recordings to be identical, except for the GOP parameter being defined in Limitless.

Code: [Select]
General
Complete name                            : \\WILMA\Recorded TV\Limitless\Limitless - S01E21 - Finale (2)\Limitless - S01E21 - Finale (2)-3.jts.cnk
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 176 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Format settings, GOP                     : M=4, N=24
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Color range                              : Limited



A remuxed version of one of those recordings that originally showed as "Video: unknown codec" in MC is correctly identified as h.264 video in MC's [compression] tag. The remuxed version still doesn't have any GOP parameter, but it does have a new "Codec ID: 27" parameter. So I dunno what's going on there.



Are there any other combos you found?

I'm still looking, and ignoring all recordings with AAC LATM audio.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner
Pages: [1]   Go Up