Closed Steeler333 closed 2 years ago
Correction! I had a typo at may cmd command, that way value was not set - sorry for this!
However one Question remains: Since I have several files with different "timeshift" values.
Is there a command, (when processing more than one files), to "auto-detect" the timeshift value for each video? Currently my command line is this: echo %tsCommand3% >> %metaFile% timeshift=XXX, track=128
However the XXX value, is most likely only correct for 1 file, is there some value to auto detect for each file?
In your script you would have to run tsmuxer.exe inputfile
and grab the timeshift value before running tsmuxer.exe file.meta outputfile
Thank you for helping out.
Can you point me where to put the "inputfile" value in my code (i'm not that advanced in scripting).
Thanx!
SET tsmuxer="C:\FILEPATH\tsMuxeR.exe"
for /f %%a in ('dir /b *.mpg *.vob') do call :make_ts "%%a"
echo DONE & pause
goto :eof
:make_ts
set metaFile=".\00.meta"
set tsCommand1=MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
set tsCommand2=V_MPEG-2, "%~1",
set tsCommand3=A_AC3, "%~1",
echo %tsCommand1% > %metaFile%
echo %tsCommand2% >> %metaFile%, track=224
echo %tsCommand3% >> %metaFile%, track=128
%tsmuxer% "%metaFile%" "%~n1.ts"
goto :eof
@Steeler333 I am not too familiar with batch scripting neither :( There are two ways to use tsMuxer: 'tsMuxer input.mpg' will show all parameters including the timeshift. This is how tsMuxer creates the .meta file. 'tsMuxer metafile.meta output.ts' will transmux.
So before calling make_ts, call a function show_params which will exec %tsmuxer% "%~n1" and parse the timeshift parameter.
The GUI sets the timeshift
value to whatever tsMuxeR returned as Stream delay
while running in info mode, i.e. when passed the media file only instead of the metafile and output file.
Here's an example output of tsMuxer running in info mode :
$ ./tsMuxer/tsmuxer bbb_sunflower_1080p_30fps_normal.mkv
tsMuxeR version git-24ae935. github.com/justdan96/tsMuxer
Track ID: 1
Stream type: H.264
Stream ID: V_MPEG4/ISO/AVC
Stream info: Profile: High@4.1 Resolution: 1920:1080p Frame rate: 30
Stream lang: und
Stream delay: 67
Track ID: 2
Stream type: MPEG-Audio
Stream ID: A_MP3
Stream info: Bitrate: 160Kbps Sample Rate: 48KHz Channels: 2 Layer: 3
Stream lang: und
Track ID: 3
Stream type: AC3
Stream ID: A_AC3
Stream info: Bitrate: 320Kbps Sample Rate: 48KHz Channels: 5.1
Stream lang: und
Stream delay: 42
Duration: 00:10:34.600
As you can see, Stream delay
is defined for both the video and the AC3 audio track. So your script would need to first run tsmuxer in "info mode" (tsmuxer "%~n1"
) for each of the files it's processing, parse the output looking for Stream delay
tags, save them, and then use them as timeshift
arguments in the generated metafile.
The pseudocode you'd need to parse this would work out to something like this :
array track_infos[][]
int last_track_id
while read line
(name, value) = split(line, ':\s+', 2)
if value == nil
continue
if name == 'Track ID'
last_track_id = to_int(value)
else
track_infos[last_track_id][name] = value
endwhile
However, I have no idea how that translates into a BAT file or whether it's even possible to do it in that language without any external tools.
Also, have you considered using just ffmpeg to remux these files into a TS container? If you don't need any extra processing for the audio/video streams, a simple stream copy with ffmpeg might be what you need :
ffmpeg -i file.mpg -c copy -map 0 file.ts
In my (very limited) testing, ffmpeg seems to automagically copy the track delay to the TS container, so the timeshift
problem described here doesn't exist when using this approach.
Closing, can be reopened upon request.
Hello, i'm new to TSmuxer, so if my issue is incorrect, please let me know how to fix my problem (via settings).
I have a big folder of seperate .vob/.mpg files, that I'd like to convert to .ts, since they work better with my media devices. To do this, I tried it in command line mode, which worked with no issues.
However after checking the files with the "media info" software, I figured there's a difference in the output file, depending if converted in command line mode or via the gui.
Via GUI, it adds the proper "timeshift" value, to the new .ts file. With the same settings in the .meta file, and converting via command line, the value it looks like is missing (atleast not visible in the "media info" software).
In case this could be fixed in the cmd mode, would it be possible in cmd mode, to kinda "auto-detect" the "timeshift" value for each video and not have to set 1 value, that would be applied to a bunch of files, when converting more than 1 video.
Tested this on version 2.6.12 and git 146594c
Here's the meta, which is used: MUXOPT --no-pcr-on-video-pid --new-audio-pes --hdmv-descriptors --vbr --vbv-len=500 V_MPEG-2, "FILEPATH", track=224 A_AC3, "FILEPATH", timeshift=-383ms, track=128