0

I made a Python script to use FFMPEG to extract a subtitles file(ASS) from an MKV, modify a few things with Pysubs2, and then remux it as a new sub. The code works has worked correctly until now, but a file that I decided to use it for today is now throwing an error message that I'm just unable to understand what's going on.

This is the equivalent of the command that I use with Python to mux the ASS file to the MKV

ffmpeg -loglevel quiet -report -y -i "Videofile_02.mkv" -i "Videofile_02.ass" -c copy -map 0:v -map 0:a -map 0:s:0 -map 1 -metadata:s:s:1 language=eng -metadata:s:s:1 handler_name=English -metadata:s:s:1 title=Test -max_interleave_delta 0 -disposition:s:0 0 -disposition:s:1 default "./Finished/Videofile_02.mkv"

I use the -report option to attempt to understand what's happening, but, this is what I get:

...
Applying option disposition:s:0 (disposition) with argument 0.
Applying option disposition:s:1 (disposition) with argument default.
Successfully parsed a group of options.
Opening an output file: ./Finished/Videofile_02.mkv.
[file @ 0x55abe42c5780] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
[matroska @ 0x55abe42b8c00] get_metadata_duration returned: 1431013000
[matroska @ 0x55abe42b8c00] Write early duration from metadata = 1431013
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Error initializing output stream 0:4 -- 
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:4 -> #0:1 (copy)
  Stream #0:1 -> #0:2 (copy)
  Stream #0:2 -> #0:3 (copy)
  Stream #1:0 -> #0:4 (copy)

[AVIOContext @ 0x55abe42c59c0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x55abe4212cc0] Statistics: 1050661 bytes read, 2 seeks
[AVIOContext @ 0x55abe4258c40] Statistics: 34795 bytes read, 0 seeks

From what I'm understanding, seems like there might be a problem muxxing the subtitle file into the MKV(Maybe?). As an aditional piece of data, this file is part of a set of files that I'm applying this process to, all have the same characteristics, and the first one completed correctly, muxxed the subtitle file and is viewable, but from the 2nd to 6th it show this problem, and the others work correctly, so I don't think that the problem could be caused due to syntax errors in the ASS file, or things like that. Also, probably very important, I tried to mux these files using MKV Toolnix, and it merged them correctly, so is not like is not possible to mux them or there is an error, just FFMPEG that is not allowing me to.

Does someone knows what might be a cause, or what might I do to gather more info? Sorry, I'm not very into using these tools, so I'm not sure what kind of other data I could provide, or what else to check.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.