I wrote this to convert Judge Judy from ts files created by Plex to mkv files. This one seems to meet my requirements for a mass convert-all.
Find a file
2019-05-30 22:52:57 -07:00
README.md Update README.md 2019-05-30 22:52:57 -07:00
ts-to-mkv.sh More features 2019-05-30 22:38:07 -07:00

ts-to-mkv.sh

I wrote this to convert Judge Judy from ts files created by Plex to mkv files. This one seems to meet my requirements for a mass convert-all.

help

[info] ts-to-mkv.sh -- v2
[help] -d, path to custom ffmpeg (default: /data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg)
[help] -k, keep the original ts file
[help] -p, custom path to scan recursively (default: ./)

Requirements

  • ffmpeg 4 or better

Example Output

root@rn628x:/data/tv# bash ts-to-mkv.sh
[info] ts-to-mkv.sh -- v2
[info] finding files
[info] working on ./Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .ts
[debug] Infile: ./Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .ts
[debug] Outfile: ./Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .mkv
ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --ena
ble-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex
 --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mpegts, from './Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .ts':
  Duration: 00:17:33.44, start: 1.401556, bitrate: 16470 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x102](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s
Input #1, lavfi, from 'movie='./Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .ts'[out+subcc]':
  Duration: N/A, start: 1.500100, bitrate: N/A
    Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Stream #1:1: Subtitle: eia_608
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #1:1 -> #0:3 (eia_608 (cc_dec) -> subrip (srt))
Press [q] to stop, [?] for help
[libx264 @ 0x5536c00] using SAR=1/1
[libx264 @ 0x5536c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5536c00] profile Progressive High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x5536c00] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to './Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .mkv':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 1k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 384 kb/s                                                                                                                                                      Stream #0:2(spa): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s                                                                                                                                                         Stream #0:3(eng): Subtitle: subrip (srt)
    Metadata:
      encoder         : Lavc58.35.100 srt
[Parsed_movie_0 @ 0x53d3a40] EOF timestamp not reliable2.12 bitrate=4460.1kbits/s speed=0.724x
frame=31567 fps= 22 q=-1.0 Lsize=  575764kB time=00:17:33.33 bitrate=4477.8kbits/s speed=0.723x
video:500855kB audio:74061kB subtitle:90kB other streams:0kB global headers:0kB muxing overhead: 0.131831%
[libx264 @ 0x5536c00] frame I:397   Avg QP:18.31  size:131260
[libx264 @ 0x5536c00] frame P:8915  Avg QP:22.13  size: 33958
[libx264 @ 0x5536c00] frame B:22255 Avg QP:25.09  size:  7101
[libx264 @ 0x5536c00] consecutive B-frames:  1.8%  2.6% 30.1% 65.4%
[libx264 @ 0x5536c00] mb I  I16..4:  7.3% 89.3%  3.4%
[libx264 @ 0x5536c00] mb P  I16..4:  1.6%  5.2%  0.2%  P16..4: 49.9% 11.6%  8.2%  0.0%  0.0%    skip:23.3%
[libx264 @ 0x5536c00] mb B  I16..4:  0.1%  0.2%  0.0%  B16..8: 35.5%  1.1%  0.2%  direct: 1.1%  skip:61.8%  L0:41.5% L1:54.1% BI: 4.3%
[libx264 @ 0x5536c00] 8x8 transform intra:79.6% inter:90.9%
[libx264 @ 0x5536c00] coded y,uvDC,uvAC intra: 61.9% 65.4% 17.5% inter: 11.5% 17.0% 0.1%
[libx264 @ 0x5536c00] i16 v,h,dc,p: 24% 32% 12% 33%
[libx264 @ 0x5536c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 30%  3%  3%  4%  4%  4%  4%
[libx264 @ 0x5536c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 44%  9%  4%  7%  6%  6%  4%  5%
[libx264 @ 0x5536c00] i8c dc,h,v,p: 43% 26% 24%  7%
[libx264 @ 0x5536c00] Weighted P-Frames: Y:0.5% UV:0.2%
[libx264 @ 0x5536c00] ref P L0: 58.2% 11.4% 23.3%  7.1%  0.0%
[libx264 @ 0x5536c00] ref B L0: 86.5% 11.3%  2.3%
[libx264 @ 0x5536c00] ref B L1: 96.2%  3.8%
[libx264 @ 0x5536c00] kb/s:3894.93
[info] successful conversion
[debug] deleting original file
removed './Judge Judy/Season 23/Judge Judy (1996) - S23E214 - Ice Cream Parlor Owner Not so Sweet .ts'