.ts files recorded with TVTest, EDCB or a PT3 tuner card, and .m2ts files copied from Blu-ray discs, are hard to use in editing software or on phones. FFmpeg can convert them to MP4 in seconds without re-encoding, so no quality is lost.

Japanese copyright law restricts redistributing or re-uploading broadcast content, so keep converted recordings for personal viewing.

1. TS / m2ts / BDAV at a Glance

Format Main use Characteristics
.ts (MPEG-TS) Japanese terrestrial TV, streaming Japanese terrestrial TV is MPEG-2 Video + AAC; 188-byte packets
.m2ts Blu-ray / BDAV MPEG-2, H.264 or HEVC; AAC, AC-3, DTS or LPCM
.mts AVCHD camcorders Essentially the same as .m2ts; AVCHD specification

The video (MPEG-2 Video, H.264, HEVC) and most of the audio (AAC, AC-3, DTS) in all three can go into MP4. Blu-ray LPCM audio cannot (see section 7). So the most efficient approach is to change only the container to MP4 (a remux). A remux keeps Japanese terrestrial MPEG-2 video as MPEG-2, though, and MPEG-2 is not on the lists of formats iPhone and Android support. For phones, re-encode to H.264 (Error 2 in section 9).

2. The Fastest Lossless Remux

ffmpeg -i input.ts -c copy -movflags +faststart output.mp4
  • -c copy … no re-encoding; completes in seconds
  • -movflags +faststart … moves the file’s index (the moov atom) to the front, so web playback can start before the download finishes. Not needed for local playback.

You don’t need to add aac_adtstoasc
In TS, every AAC audio frame has its own ADTS (Audio Data Transport Stream) header. MP4 instead stores the audio settings once, as an ASC (AudioSpecificConfig). FFmpeg does this conversion (aac_adtstoasc) automatically when it writes MP4, because autobsf is part of the default -fflags value. If you add -bsf:a aac_adtstoasc yourself, files with AC-3 audio stop with Codec 'ac3' ... is not supported by the bitstream filter, and TS output gets broken audio.

Drop subtitles for a simpler output

Japanese terrestrial TV often includes ARIB subtitles, which MP4 cannot hold. To output only video and audio:

ffmpeg -i input.ts -map 0:v -map 0:a -c copy -movflags +faststart output.mp4

3. PCR Wraparound (Timestamp Rollover)

TS stores the PCR (Program Clock Reference) and PTS as 33-bit values. They go back to 0 after about 26.5 hours of clock time, so a recording can contain a rollover. Where it happens depends on the clock value, not on the length of the recording.

FFmpeg corrects the rollover automatically (-correct_ts_overflow is on by default). When the timestamps jump partway through a recording, FFmpeg prints timestamp discontinuity, joins the timeline back together and keeps going.

If some packets in a recording have no PTS (presentation timestamp), put -fflags +genpts before -i to fill in the PTS from the DTS (decoding timestamp):

ffmpeg -fflags +genpts -i input.ts -c copy -movflags +faststart output.mp4

You can also split a long TS into pieces first and convert them one by one:

# Split into 1-hour chunks
ffmpeg -i input.ts -c copy -map 0 -f segment -segment_time 3600 -reset_timestamps 1 part_%03d.ts

Then convert each piece to MP4 and join them.

4. Cutting Out CMs (Multiple Segments)

To keep only the program itself and cut out the commercials (CMs):

Step 1: Note the start and end times

Play the file and write down where each part of the program starts and ends. For example, the program runs from 00:01:30 to 00:25:00 and from 00:28:00 to 00:52:30.

Step 2: Extract each segment (no re-encoding)

# Part 1 (1:30 to 25:00)
ffmpeg -ss 00:01:30 -to 00:25:00 -i input.ts -c copy part1.ts

# Part 2 (28:00 to 52:30)
ffmpeg -ss 00:28:00 -to 00:52:30 -i input.ts -c copy part2.ts

Step 3: Concat the two parts into MP4

# Build concat.txt
echo "file 'part1.ts'" > concat.txt
echo "file 'part2.ts'" >> concat.txt

# Concatenate
ffmpeg -f concat -safe 0 -i concat.txt -c copy -movflags +faststart main.mp4

For a clean cut, set -ss to a keyframe position first. See the guide to trimming videos for details.

5. Handling ARIB Subtitles

Japanese terrestrial TV carries its subtitles (closed captions) in ARIB STD-B24 format. FFmpeg can keep them in a TS output, but not in MP4: mapping them into an MP4 (for example with -map 0) stops with Could not find tag for codec arib_caption. There are two options:

ffmpeg -i input.ts -map 0:v -map 0:a -c copy -movflags +faststart output.mp4

-map 0:v -map 0:a selects only the video and audio streams, so the subtitles are left out.

Option B: Extract subtitles and convert to SRT

If your FFmpeg build has an ARIB caption decoder (libaribcaption or libaribb24), FFmpeg can convert the captions to SRT itself, for example with ffmpeg -fix_sub_duration -i input.ts -map 0:s:0 subtitle.srt. ffmpeg -decoders lists the decoders in your build (the gyan.dev full build has both). Without them, use a separate tool such as Caption2Ass_PCR to make SRT/ASS. Then burn the subtitles into the picture with FFmpeg:

# Burn in subtitles from subtitle.srt (prepare it in advance)
ffmpeg -i input.ts -vf "subtitles=subtitle.srt:force_style='FontName=Meiryo,FontSize=20'" \
  -c:a copy -movflags +faststart output_subbed.mp4

See burning subtitles into video for more.

6. Repairing Recordings with Dropped Packets

Recordings made with poor reception can have dropped TS packets, which cause errors when you remux them.

Recovery command

ffmpeg -fflags +genpts -i input.ts -c copy \
  -movflags +faststart output.mp4
  • -fflags +genpts … fill in a missing PTS from the DTS; it is an input option, so it goes before -i

Playback may stutter where packets were lost. If only some packets are damaged, this often gets the whole file converted. If damaged audio frames stop it with Error parsing ADTS frame header, re-encode only the audio (-c:v copy -c:a aac) to get to the end.

7. Extracting from BDAV (Blu-ray)

On a disc recorded by a Blu-ray recorder (BDAV), the .m2ts files are in BDAV/STREAM/. On commercial Blu-rays and other BDMV-format discs, they are in BDMV/STREAM/. This example converts BDMV/STREAM/00001.m2ts (change the path for BDAV):

ffmpeg -i BDMV/STREAM/00001.m2ts -c:v copy -c:a copy -map 0:v:0 -map 0:a:0 \
  -movflags +faststart output.mp4

If the audio is LPCM (pcm_bluray) or Dolby TrueHD, this command stops with an error: MP4 cannot hold LPCM, and FFmpeg treats TrueHD in MP4 as experimental. For those, replace -c:a copy with -c:a aac -b:a 192k.

FFmpeg cannot process AACS-encrypted Blu-rays unless they are decrypted first. In Japan, circumventing technical protection measures is illegal even for personal copies (Article 30(1)(ii) of the Copyright Act).

8. Batch Processing (Convert Multiple TS Files at Once)

Windows batch file (save it as ts_to_mp4.bat and drag TS files onto it):

@echo off
setlocal enabledelayedexpansion
if "%~1"=="" (
  echo Usage: drag TS files onto this .bat file
  pause & exit /b 1
)
:loop
if "%~1"=="" goto end
echo Converting: %~nx1
ffmpeg -fflags +genpts -i "%~1" -c copy -movflags +faststart "%~dpn1.mp4"
shift
goto loop
:end
echo All done!
pause

Bash version:

for f in *.ts; do
  ffmpeg -fflags +genpts -i "$f" -c copy -movflags +faststart "${f%.ts}.mp4"
done

9. Troubleshooting

Error 1: Malformed AAC bitstream detected

Cause: autobsf, the default -fflags value that applies aac_adtstoasc automatically when writing MP4, has been switched off. Writing -fflags genpts on the output side without a + switches it off.
Fix: Remove the output-side -fflags, or write it with a + (+genpts). Adding -bsf:a aac_adtstoasc also works, but only when the audio is AAC.

Error 2: File converts but won’t play on a phone

Cause: Japanese terrestrial TV video is MPEG-2 Video, and -c copy puts it into the MP4 unchanged. iPhone and Android do not list MPEG-2 as a supported format, so phones may refuse to play it.
Fix: Re-encode the video to H.264 (the command in Q4). 1440×1080 video is 16:9 HD stored with wide pixels (SAR 4:3), and it still displays at 16:9 after re-encoding.

Error 3: Two audio tracks (second audio / bilingual)

Cause: A program with two or more audio programs carries them as separate audio streams. Bilingual broadcasts can also be sent as “dual mono”, with the main and secondary audio inside one audio stream. In that case -map 0:a:0 cannot separate them.
Fix:

# Main audio only
ffmpeg -i input.ts -map 0:v:0 -map 0:a:0 -c copy output.mp4

# Keep both tracks (Windows Media Player can switch between them)
ffmpeg -i input.ts -map 0:v:0 -map 0:a -c copy output.mp4

Error 4: Chapters disappear

Cause: TS has no chapter information that FFmpeg can read, so -map_chapters 0 has nothing to carry over.
Fix: Add the chapters again after converting to MP4.

Error 5: BS4K (ISDB-S3, 4K broadcast) recordings won’t open

Cause: Unlike terrestrial TV, BS4K and 110° CS4K broadcasts use MMT/TLV instead of MPEG-TS. FFmpeg 8.1 cannot read MMT/TLV, so it cannot open the recording.
Fix: First export the recording to MP4 or a similar format with the recorder or its software.

FAQ

Q1. Should I split TS files with TsSplitter before feeding them to FFmpeg?
A. That used to be necessary. Current FFmpeg handles Japanese terrestrial TS directly, so FFmpeg alone is enough in almost all cases. Only recordings with many dropped packets may benefit from running them through TsSplitter first.

Q2. Why do BonDriver+TVTest recordings use .ts and not .m2ts?
A. Japanese terrestrial TV is stored as MPEG-TS with 188-byte packets, and .ts is the usual extension for that. BDAV uses .m2ts with 192-byte packets: the same TS with a timestamp added in front of each packet. FFmpeg handles both the same way.

Q3. Does remuxing reduce picture quality?
A. No. -c copy copies the video and audio data without changing a single bit.

Q4. Some players won’t play my converted file
A. Check that you used -movflags +faststart and, for HEVC recordings, -tag:v hvc1. If the file still does not play, re-encode to H.264:

ffmpeg -i input.ts -c:v libx264 -crf 20 -c:a aac -b:a 192k -movflags +faststart output.mp4

Q5. Why is Japanese TV recording so complicated?
A. A Japanese terrestrial TS keeps the whole broadcast multiplex as defined in ARIB STD-B10/B32. Besides the program, it carries subtitles, data broadcasts, EPG/EIT information and even Emergency Warning System (EWS) data. MP4 has no place for most of this, so the conversion keeps the main program and drops the rest.