Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Thanks. I've been trying it since the release and it works.  I've only found one case in which it doesn't, which is videos which have soft telecine 3:2 pulldown that play in 29.97fps but are stored in original source framerate of 23.976fps.  The playback device/software uses these tags that tell it which frames to duplicate to output 29.97 from the film source 23.976.

Here's an example of such an anime video's mediainfo output

The actual framerate is 23.976 or 24fps based on the # of frames, but the file contains those pulldown tags to specify which frames get duplicated by the player.  This allows fewer actual frames to be encoded and stored, by not encoding the duplicates to save space.  

When used as an input file, this produces a video stream that is 29.97 fps, but has a shorter duration than the original file and its audio tracks because the duplicate frames were not included and upscaled, and the soft pulldown tags are not retained.  The resulting file runs out of video before the audio track ends.

When I use ffprobe -i  on the file, 29.97 fps and 29.97 tbr are reported for the video stream.

I suspect this should be fixable, as if I use jUpscaler to extract and upscale the frame images, then run 

.\ffmpeg.exe -y -r 23.976 -i ..\upscaled_frames\frame%08d.jpg -i '.\testin.mkv' -map 0:v:0 -map 1:a? -map 1:s? -c:a copy -c:s copy -c:v libx264 -r 29.97 -pix_fmt yuv420p testout.mkv

I get the desired result, with everything in sync, with the upscaled video stream, 23.976 stored fps, 29.97 playback fps, and all audio and subtitle streams copied over.  Mediainfo says the file is vfr, 

So keeping all audio and subtitle streams should be as easy as adjusting the ffmpeg calls jUpscaler makes, instead of -map 1:a:0?, use -map 1:a?; and same for subtitle, -map 1:s?

If an input file has no subtitle tracks, this should not throw any errors about it.

I don't know how to detect the 23.976 pulldown thing to do this automatically when needed, but for now I can just extract and upscale and batch run this ffmpeg argument set.


Thanks for all your hard work! Hope this info is useful.

Small update: Had weird issues with audio cutout when seeking to certain parts of the resulting video using the ffmpeg command I stated above.

Leaving out subtitle tracks did not have this issue.  Turned out that adding 

-max_interleave_delta 0

solved this issue when copying subtitle streams.  

Error was present when muxing in srt subtitles, while vob subtitles worked fine.

Final command used for dual audio multi-sub film->ntsc anime files:

.\ffmpeg.exe -y -r 24000/1001 -i ..\upscaled_frames\frame%08d.jpg -i '.\input.mkv' -map 0:v:0 -map 1:a? -map 1:s? -c:a copy -c:s copy -c:v libx264 -r 30000/1001 -pix_fmt yuv420p -max_interleave_delta 0 output.mkv

Hope this helps anyone upscaling dual audio and/or multi-sub anime that is running into odd results.

Note:

-map 1:a? basically wildcard maps all audio tracks from the original video file, same for 1:s? for subtitle tracks.  The ? ignores the option if no tracks of that type are present, i.e. no embedded subtitles.