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

About 0,5 first second stop after encode but result fine if move original video to MKV then encode #3728

Closed
thelonghcm opened this issue Jul 27, 2021 · 6 comments

Comments

@thelonghcm
Copy link

Problem Description

My original video is .MTS, when encode this video to MP4 with preset Fast 1080p30, about 0,5 first second of encoded video is stopped, frames does not moving.
But, if change original video is .MTS to .MKV by MKVToolnix (mean change container format only), and encode with the same preset above, the new encoded video is playing fine, no problem like above.
I upload 4 videos (above) to this folder to check and find solution to solve it:
https://drive.google.com/drive/folders/1VFCUiqEsGMCk6uqSRxCI0s33XU8j8NjO?usp=sharing

Activity Log, Crash Log or any other details

HandBrake 1.4.0 (2021071800)
OS: Microsoft Windows NT 10.0.19043.0
CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Ram: 16303 MB, 
GPU Information:
  NVIDIA Quadro M2000M - 27.21.14.5296
Screen: 1920x1080
Temp Dir: D:\TEMP\
Install Dir: D:\IT\PortableApps\HandBrake\
Data Dir: C:\Users\Administrator\AppData\Roaming\HandBrake

-------------------------------------------


# Starting Encode ...
[16:56:47] base preset: Fast 1080p30
Remote Process started with Process ID: 9484 using port: 8037. Max Allowed Instances: 1
Worker: Starting HandBrake Engine ...
Worker: Starting Web Server on port 8037 ...
Worker: Disconnected worker monitoring enabled!
[16:56:47] Compile-time hardening features are enabled
[16:56:47] hb_init: starting libhb thread
[16:56:47] Starting work at: Tue Jul 27 16:56:47 2021
[16:56:47] 1 job(s) to process
[16:56:47] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 160,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd",
      "copy:mp2"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": true,
    "File": "D:\\Documents\\Videos\\Original-1.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 13,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1080",
          "width": "1920"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "2",
          "rate": "27000000/900000"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "D:\\Documents\\Videos\\Original.mkv"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x264",
    "Level": "4.0",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "main",
    "Quality": 22,
    "QSV": {
      "Decode": false
    }
  }
}
[16:56:47] CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
[16:56:47]  - Intel microarchitecture Skylake
[16:56:47]  - logical processor count: 8
[16:56:47] Intel Quick Sync Video support: no
[16:56:47] hb_scan: path=D:\Documents\Videos\Original.mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\Documents\Videos\Original.mkv
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
src/libbluray/bluray.c:2646: nav_get_title_list(D:\Documents\Videos\Original.mkv\) failed
[16:56:47] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvlibdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
dread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[16:56:47] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'D:\Documents\Videos\Original.mkv':
  Metadata:
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2021-07-27T09:51:00.000000Z
  Duration: 00:00:01.02, start: 0.000000, bitrate: 15017 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      BPS             : 14731056
      DURATION        : 00:00:01.018000000
      NUMBER_OF_FRAMES: 60
      NUMBER_OF_BYTES : 1874527
      _STATISTICS_WRITING_APP: mkvmerge v59.0.0 ('Shining Star') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-07-27 09:51:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      BPS             : 247466
      DURATION        : 00:00:00.960000000
      NUMBER_OF_FRAMES: 29
      NUMBER_OF_BYTES : 29696
      _STATISTICS_WRITING_APP: mkvmerge v59.0.0 ('Shining Star') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-07-27 09:51:00
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[16:56:47] scan: decoding previews for title 1
[16:56:47] scan: audio 0x1: ac3, rate=48000Hz, bitrate=256000 Unknown (AC3) (2.0 ch) (256 kbps)
[16:56:48] scan: 10 previews, 1920x1080, 59.940 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-1
[16:56:48] libhb: scan thread found 1 valid title(s)
[16:56:48] Skipping subtitle scan.  No suitable subtitle tracks.
[16:56:48] Starting Task: Encoding Pass
[16:56:48] Skipping crop/scale filter
[16:56:48] work: track 1, dithering not supported by codec
[16:56:48] work: only 1 chapter, disabling chapter markers
[16:56:48] job configuration:
[16:56:48]  * source
[16:56:48]    + D:\Documents\Videos\Original.mkv
[16:56:48]    + title 1, chapter(s) 1 to 1
[16:56:48]    + container: matroska,webm
[16:56:48]    + data rate: 15017 kbps
[16:56:48]  * destination
[16:56:48]    + D:\Documents\Videos\Original-1.mp4
[16:56:48]    + container: MPEG-4 (libavformat)
[16:56:48]      + align initial A/V stream timestamps
[16:56:48]  * video track
[16:56:48]    + decoder: h264 8-bit
[16:56:48]    + filters
[16:56:48]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[16:56:48]      + Decomb (mode=39)
[16:56:48]      + Framerate Shaper (mode=2:rate=27000000/900000)
[16:56:48]        + frame rate: 59.940 fps -> peak rate limited to 30.000 fps
[16:56:48]    + Output geometry
[16:56:48]      + storage dimensions: 1920 x 1080
[16:56:48]      + pixel aspect ratio: 1 : 1
[16:56:48]      + display dimensions: 1920 x 1080
[16:56:48]    + encoder: H.264 (libx264)
[16:56:48]      + preset:  fast
[16:56:48]      + profile: main
[16:56:48]      + level:   4.0
[16:56:48]      + quality: 22.00 (RF)
[16:56:48]      + color profile: 1-1-1
[16:56:48]  * audio track 1
[16:56:48]    + decoder: Unknown (AC3) (2.0 ch) (256 kbps) (track 1, id 0x1)
[16:56:48]      + bitrate: 256 kbps, samplerate: 48000 Hz
[16:56:48]    + mixdown: Stereo
[16:56:48]    + encoder: AAC (libavcodec)
[16:56:48]      + bitrate: 160 kbps, samplerate: 48000 Hz
[16:56:48] sync: expecting 61 video frames
[16:56:48] encx264: min-keyint: 30, keyint: 300
[16:56:48] encx264: encoding at constant RF 22.000000
[16:56:48] encx264: unparsed options: level=4.0:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=30
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 4.0, 4:2:0, 8-bit
[16:56:48] reader: done. 1 scr changes
[16:56:49] sync: first pts video is 0
[16:56:49] sync: first pts audio 0x1 is 0
[16:56:49] sync: "Chapter 1" (1) at frame 3 time 6030
[16:56:50] work: average encoding speed for job is 0.000000 fps
[16:56:51] comb detect: heavy 29 | light 0 | uncombed 1 | total 30
[16:56:51] decomb: deinterlaced 29 | blended 0 | unfiltered 1 | total 30
[16:56:51] vfr: 30 frames output, 0 dropped and 0 duped for CFR/PFR
[16:56:51] vfr: lost time: 0 (0 frames)
[16:56:51] vfr: gained time: 0 (0 frames) (0 not accounted for)
[16:56:51] ac3-decoder done: 29 frames, 0 decoder errors
[16:56:51] h264-decoder done: 30 frames, 0 decoder errors
[16:56:51] sync: got 30 frames, 61 expected
[16:56:51] sync: framerate min 20.000 fps, max 59.940 fps, avg 29.980 fps
x264 [info]: frame I:1     Avg QP:23.47  size:129023
x264 [info]: frame P:8     Avg QP:23.83  size: 61107
x264 [info]: frame B:21    Avg QP:25.35  size: 30081
x264 [info]: consecutive B-frames:  6.7%  0.0%  0.0% 93.3%
x264 [info]: mb I  I16..4: 26.5%  0.0% 73.5%
x264 [info]: mb P  I16..4:  7.1%  0.0%  8.8%  P16..4: 53.6% 19.2%  8.8%  0.0%  0.0%    skip: 2.5%
x264 [info]: mb B  I16..4: 12.5%  0.0%  1.1%  B16..8: 42.9% 11.1%  0.4%  direct:25.1%  skip: 6.9%  L0:45.7% L1:46.2% BI: 8.1%
x264 [info]: coded y,uvDC,uvAC intra: 40.2% 85.9% 23.4% inter: 26.3% 71.0% 0.6%
x264 [info]: i16 v,h,dc,p: 29% 23% 29% 18%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 18% 24%  7%  7%  6%  7%  5%  5%
x264 [info]: i8c dc,h,v,p: 52% 20% 20%  7%
x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x264 [info]: ref P L0: 61.4% 38.6%
x264 [info]: ref B L0: 80.6% 19.4%
x264 [info]: ref B L1: 88.7% 11.3%
x264 [info]: kb/s:9674.19
[16:56:51] mux: track 0, 30 frames, 1249541 bytes, 9673.87 kbps, fifo 32
[16:56:51] mux: track 1, 44 frames, 18255 bytes, 141.33 kbps, fifo 64
[16:56:51] Finished work at: Tue Jul 27 16:56:51 2021
[16:56:51] libhb: work result = 0

# Job Completed!

What Operating System are you running?

Windows 10

What version of HandBrake are you running?

1.4.0

Where did you download HandBrake from?

https://handbrake.fr/downloads.php

@thelonghcm
Copy link
Author

thelonghcm commented Jul 27, 2021

This error above occurs when encoding with H.264 and even with H.265 video encoder

@Nomis101
Copy link
Contributor

I can reproduce this with H.264 and H.265 as .mp4 and .mkv. It seems there is something strange with the timestamp of your movie. I see a lot of

[h264 @ 0x7faf37008c00] non-existing PPS 0 referenced
[h264 @ 0x7faf37008c00] sps_id 0 out of range
[h264 @ 0x7faf37008c00] non-existing PPS 0 referenced
[20:46:20] hb_ts_stream_decode - eof
[h264 @ 0x7faf37008c00] sps_id 0 out of range
[h264 @ 0x7faf37008c00] non-existing PPS 0 referenced
[20:46:20] hb_ts_stream_decode - eof

in the encoding log. I can kind of fix this if I do with FFmpeg:
ffmpeg -fflags +genpts+igndts+discardcorrupt -i Original.MTS -c copy Original_2.MTS
and then use Original_2.MTS for HandBrake encoding. Don't know if this helps you.

@thelonghcm
Copy link
Author

Thanks Nomis101 for your solution, wish the new HandBrake can fix this automatically

@sr55
Copy link
Contributor

sr55 commented Aug 4, 2021

We don't typically repair files as that's a whole world of hurt in terms of all the possibilities that can go wrong. Especially considering the number of file types out there. it's quite common to see stream files with all manner of issues so it's quite common to need to repair them before encoding.

Will double check what the deal is with the files above before closing.

@passat1
Copy link

passat1 commented Aug 17, 2021

This is not only case when errors in source files, which are generating errors when converting with HB or some other tool, and most of this can be solved by re-muxing files with MKVToolNix.
This problem is very often with TS files, specially when they are cut with some tools.
As MKVToolNix solves most of this problems (not all), only (and best) solution is as you did, and I already suggested few times, re-mux with MKVToolNix and then recode with HB.
I do this with all TS source files.

@thelonghcm
Copy link
Author

Thanks passat1 very much

@sr55 sr55 closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants