ts-to-mkv.sh/README.md
2019-05-30 23:30:08 -07:00

75 lines
4.9 KiB
Markdown

# 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
```
root@rn628x:/data/tv# ./ts-to-mkv.sh -h
[info] ./ts-to-mkv.sh -- v2
[help] -d, path to custom ffmpeg (default: /data/sourcecode/ffmpeg/ffmpeg-4.1.3-amd64-static/ffmpeg)
[help] -f, force overwriting existing files
[help} -n, never overwrite existing files
[help] -k, keep the original ts file
[help] -q, disable output from ffmpeg (default: info)
[help] -p, custom path to scan recursively (default: ./)
```
# Requirements
* ffmpeg 4 or better
# Example Output
```
root@rn628x:/data/tv# bash ts-to-mkv.sh -f
[info] ts-to-mkv.sh -- v2
[debug] overwriting existing files
[info] finding files
[info] working on ./Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).ts
[debug] Infile: ./Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).ts
[debug] Outfile: ./Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).mkv
[info] ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
[info] built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
[info] 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 --enable-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
[info] libavutil 56. 22.100 / 56. 22.100
[info] libavcodec 58. 35.100 / 58. 35.100
[info] libavformat 58. 20.100 / 58. 20.100
[info] libavdevice 58. 5.100 / 58. 5.100
[info] libavfilter 7. 40.101 / 7. 40.101
[info] libswscale 5. 3.100 / 5. 3.100
[info] libswresample 3. 3.100 / 3. 3.100
[info] libpostproc 55. 3.100 / 55. 3.100
[info] Input #0, mpegts, from './Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).ts':
[info] Duration: 00:20:20.87, start: 0.587722, bitrate: 14699 kb/s
[info] Program 1
[info] Stream #0:0[0x101b]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], 14100 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
[info] Stream #0:1[0x1033](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
[info] Input #1, lavfi, from 'movie='./Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).ts'[out+subcc]':
[info] Duration: N/A, start: 0.587722, bitrate: N/A
[info] 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
[info] Stream #1:1: Subtitle: eia_608
[info] Stream mapping:
[info] Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
[info] Stream #0:1 -> #0:1 (copy)
[info] Stream #1:1 -> #0:2 (eia_608 (cc_dec) -> subrip (srt))
[info] Press [q] to stop, [?] for help
[libx264 @ 0x70bd980] [info] using SAR=1/1
[libx264 @ 0x70bd980] [info] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x70bd980] [info] profile Progressive High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x70bd980] [info] 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
[info] Output #0, matroska, to './Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).mkv':
[info] Metadata:
[info] encoder : Lavf58.20.100
[info] 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
[info] Metadata:
[info] encoder : Lavc58.35.100 libx264
[info] Side data:
[info] cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[info] Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
[info] Stream #0:2(eng): Subtitle: subrip (srt)
[info] Metadata:
[info] encoder : Lavc58.35.100 srt
...
[info] successful conversion
[debug] deleting original file
removed 'working on ./Cops/Cops - S28E32 - No Helmet, No Ride (RawHD).ts'
```