Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Kusoyaro6

5
Posts
1
Following
A member registered Nov 15, 2022

Recent community posts

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.

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.

I don't think the manual fps is necessary if the auto mode can catch the non-integer framerate and pass them along the chain. 

The only time I've intentionally altered fps has been to match audio/subs from other sources, like if I have good audio from one file, but good video from another, and one is 25fps and the other is 23.976.  Other methods are more appropriate for dealing with that case though.

Thanks!

Can confirm: 29.97 video input results in output 29.00 fps video.

Also noticed that only first audio track and no subtitle tracks get muxed into the final output file when multi-audio is present.  Possibly a future feature to consider :D

Probably just do a batch/shell script for the other audios/subs and fix the framerate after running the upscaler

Thanks for the great work! I do run into one problem, both in the previous version, as well as in v2 when using video as an input.  

Using videos with integer FPS, such as 30fps, 25fps, etc, no problems with auto mode or auto FPS option.

However, videos with film-type FPS, e.g. 23.976, output at 23fps with desynchronized audio.  In the previous version, when I tried manually inputting 23.976 fps in the box, the video would be extracted and upscaled, but the merge/mux step never occured. Entering an integer fps works as expected, though with the expected audio desync issue from lengthening or shortening the video track duration.

The current v2 appears to no longer have this FPS input option, and truncating the output fps to 23fps is still the behavior observed.

My untrained suspicion is somewhere along the way, when the source file's FPS is read to be automatically matched in the output, the decimal gets truncated, either when read or when sent to ffmpeg.  I don't have any other non-integer framerate videos to try at the moment, though I suppose I could find/make one to test on, like a 29.97 or 59.94 fps file to see if it outputs 29 or 59 fps.  

If passing the full decimal value is not possible, perhaps rounding to the nearest integer rather than truncating would be acceptable.

Example:

35484 frames source at 23.976fps -> 24.67 min original length

23.000 -> 25.71min (+1.04min or 62.4s) very desync by end, noticable early

24.000 -> 24.64min (-0.03min or 1.8s) much closer, only slightly noticable throughout

Of course, this would be worse for much longer source videos than half hour anime.

Sorry for the wall of text. Again, thanks for the work on the app, it is already proving useful beyond this edge case.  The batch image file upscaling particularly is really great.

Thanks!