Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening/Remuxing TS to MKV fails #149

Closed
JJKylee opened this issue Mar 29, 2020 · 10 comments
Closed

Opening/Remuxing TS to MKV fails #149

JJKylee opened this issue Mar 29, 2020 · 10 comments

Comments

@JJKylee
Copy link
Contributor

JJKylee commented Mar 29, 2020

When a TS file has an AAC audio stream (in ADTS muxing mode), StaxRip fails to open/remux it to an MKV format via FFmpeg.

Here's the log: error log
You can get the source video file from here.

The error arises because StaxRip doesn't employ the proper FFmpeg input options and bitstream filter required to remux an ADTS audio stream.

  • input options: -analyzeduration 100M -probesize 50M
  • bitstream filter: -bsf:a aac_adtstoasc

Fixing the ffmpeg command line as follows, I was able to successfully remux the same TS file:

ffmpeg -hide_banner -analyzeduration 100M -probesize 50M -i "LG New York HDR UHD 4K Demo.ts" -map 0 -c copy -bsf:a aac_adtstoasc -y "LG New York HDR UHD 4K Demo.mkv"

Thanks.

@ghost
Copy link

ghost commented Apr 5, 2020

@gnucian Please can you try the following thing, it may help find the reason:
-> change the extension of your file from ts to flv.
And try to open the file. Does it open?

@JJKylee
Copy link
Contributor Author

JJKylee commented Apr 5, 2020

Nope. Same error.
Pop-up error message is here.

@ghost
Copy link

ghost commented Apr 5, 2020

In the audio encoder windows, is "decoder" set to "Automatic" ?

@JJKylee
Copy link
Contributor Author

JJKylee commented Apr 5, 2020

Yes.

Per your suggestion, I tried changing it to ffmpeg and opened the ts file, but still the same error occurs.

I believe it is not a matter of decoding, but a matter of muxing method.

@ghost
Copy link

ghost commented Apr 5, 2020

I was trying to see whether your problem matches a similar problem found by another user.
Well it seems not...
I hope Stax will take a look at it

@ghost
Copy link

ghost commented Apr 5, 2020

BTW, when you opened this issue several days ago, I tried to download the video from the link, and I was forbidden the download due to many people downloaded that video. I just tried again, right now, and I couldn't either, for the same reason... Tried downloading another file from the site, same error!

@JJKylee
Copy link
Contributor Author

JJKylee commented Apr 5, 2020

BTW, when you opened this issue several days ago, I tried to download the video from the link, and I was forbidden the download due to many people downloaded that video. I just tried again, right now, and I couldn't either, for the same reason... Tried downloading another file from the site, same error!

That's very weird. I never failed to download the video file, and I'm still able to download the file.

Anyway, I've uploaded it to my Google drive: here. It will be deleted after a 72 hours.

@stax76
Copy link
Contributor

stax76 commented Apr 5, 2020

You can modify the pre processing at:

Main Menu > Tool > Settings > Pre Processing

Modify the existing step 'ffmpeg: Re-mux TS to MKV'

Command: powershell.exe
Arguments: -nologo -file "D:\ffmpegTsToMkv.ps1" "%source_file%" "%temp_file%.mkv"

Code:

$muxingMode = Get-MediaInfoValue $args[0] -Kind Audio -Parameter MuxingMode

if ($muxingMode -eq 'ADTS')
{
    $bsf = '-bsf:a', 'aac_adtstoasc'
}

ffmpeg -hide_banner -analyzeduration 100M -probesize 50M -i $args[0] -map 0 -c copy @bsf -y $args[1]

You need to install Get-MediaInfo however and add ffmpeg to the path env var or use the build from today, it adds all exe tools to the path env var of the process and adds all macros as env vars.

@stax76 stax76 closed this as completed Apr 5, 2020
@JJKylee
Copy link
Contributor Author

JJKylee commented Apr 5, 2020

Thanks.

I did some modification on your suggestion as follows and it works smoothly.

  1. I dot sourced Get-MediaInfo included in StaxRip in the PowerShell $PROFILE file, but since Get-MediaInfo in StaxRip does not have MediaInfo.dll in the same path, I had to copy MediaInfo.dll into the Get-MediaInfo folder in order to avoid extra errors.

  2. I put ffmpegTsToMkv.ps1 in the Get-MediaInfo folder and changed the pre-processing arguments as follows:

-nologo -file "%app_dir:Get-MediaInfo%ffmpegTsToMkv.ps1" "%source_file%" "%temp_file%.mkv"

※ ffmpeg is already in my PATH, so it didn't matter.

Thanks again.

@stax76
Copy link
Contributor

stax76 commented Apr 5, 2020

You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants