VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. I've been looking around for months now, and I can't seem to find an answer to this anywhere. I'm having this problem whenever I try to convert a video file that has some streams using the codec hdmv_pgs_subtitle. This happens every time with m2ts files and very often with mkv files when I try to convert to mp4. For example, I have this file that has a total of 18 streams (1 video + 11 audio + 6 PGS subtitles). I want to keep the video stream and the two last audio streams. So let's say I put that in:

    $ ffmpeg -i videofile.m2ts -map 0:0 -c:v copy -map 0:10 -acodec copy -map 0:11 -acodec copy -f mp4 videofile.mp4

    It's gonna work, but before it starts to actually convert anything it can hang for hours. Adding -loglevel debug shows that before doing any conversion, ffmpeg goes through the whole video file and every single stream and it sends an infinity of these warnings

    $[mpegts @ 0x7fa891000000] Non-increasing DTS in stream 16: packet 89 with DTS 59240150, packet 90 with DTS 59234408

    It doest that for every single stream regardless if they've been mapped or not. Using negative mapping doesn't change a thing. Other things I have tried yet: -probesize,-analyzeduration, -use_wallclock_as_timestamps, the following fflags mpegts_copyts, fix_teletext_pts, skip_unknown_pmt, igndts,+gnpts. Also tried adding copytb,-an,-sn, and using -ss with a time slightly after the start of the video like -ss 0.125 and certainly many other things I'm just not remembering right now.

    With some videofile it's not going to hang very long, maybe 15-20 minutes but with some files it can hang for as long as 5-6 hours before starting any conversion, which is kind of annoying when you're using crf and once it starts you realize that the resulting bitrate is too low or way too high, because it means, I'm gonna have to waitthe 5-6 hours once more if I want to change that.

    While it does that, for some videos, (I have no idea why it happens with some and doesn't with others), ffmpeg it's going to load the entire video in the RAM. So if the file is 70Gb, first it's going to use my 32 Gb of RAM and then compress some memory up until the whole 70Gb will be loaded in the RAM and when it gets there, it basically means it's about to start converting and the RAM is freed rather quickly and it starts converting once it's done doing that.

    All of this only happens in the presence of sup subtitles streams even though these streams haven't been selected. Does anybody knows how to avoid that. I've llooked around so much and I haven't been able to find anything that addresses that yet.
    Quote Quote  
  2. You can't remove what you don't want using a different program, before doing the conversion?
    Quote Quote  
  3. Member netmask56's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Search Comp PM
    With MKV files use MKvToolNix and deselect unwanted streams. Takes minutes to remux to a new container. Then use this MKV file to convert to whatever... then there is always this program https://www.videohelp.com/software/MkvToMp4
    SONY 75" Full array 200Hz LED TV, Yamaha A1070 amp, Zidoo UHD3000, BeyonWiz PVR V2 (Enigma2 clone), Chromecast, Windows 11 Professional, QNAP NAS TS851
    Quote Quote  
  4. -sn (input/output)

    As an input option, blocks all subtitle streams of a file from being filtered or being automatically selected or mapped for any output. See -discard option to disable streams individually.

    As an output option, disables subtitle recording i.e. automatic selection or mapping of any subtitle stream. For full manual control see the -map option.
    source: https://www.ffmpeg.org/ffmpeg-all.html#Subtitle-options
    Have you tried putting '-sn' before the input?
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Thank you all for taking the time to answer me.

    Originally Posted by netmask56 View Post
    With MKV files use MKvToolNix and deselect unwanted streams. Takes minutes to remux to a new container. Then use this MKV file to convert to whatever... then there is always this program https://www.videohelp.com/software/MkvToMp4
    @netmask56 Indeed This is one of the workaround I've been using and it works great, but I've written a script to batch convert groups of files so I was hoping to find a more integrated way of dealing with this from the command line.

    @Selur I did try -sn as input and output option and it still did go through all the subtitles. -map is usually with I'm using and it doesn't prevent that from happening either. I haven't tried the -discard option, so I'm gonna try that. Thank you very much.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!