digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Capture, Record, Transfer (https://www.digitalfaq.com/forum/video-capture/)
-   -   Ffmpeg won't convert VHS captured .ts to .mkv? (https://www.digitalfaq.com/forum/video-capture/15050-ffmpeg-convert-vhs.html)

fredvhs 04-03-2025 10:20 AM

Ffmpeg won't convert VHS captured .ts to .mkv?
 
Hi - I'm digitizing vhs tapes with a Hauppauge Colossus capture card and Mediaportal on windows 7. They're captured as .ts files and the .ts files play well, with no sign of corruption.

But I'd like to convert them to .mkv, and ffmpeg (version 2023-08-28-git-b5273c619d-essentials_build-www.gyan.dev) fails at this. I use
Code:

ffmpeg.exe -i test.ts -c copy test.mkv
and get these errors repeated many times:
Code:

[mpegts @ 00000000003d6d40] Packet corrupt (stream = 0, dts = 46105).
[mpegts @ 00000000003d6d40] Packet corrupt (stream = 0, dts = 49107).
[h264 @ 00000000003fc580] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 00000000003fc580] decode_slice_header error
[h264 @ 00000000003fc580] no frame!
...etc...
[in#0/mpegts @ 00000000003d6b80] corrupt input packet in stream 0
[mpegts @ 00000000003d6d40] Packet corrupt (stream = 0, dts = 247305).
...etc...

The resulting mkv file is much smaller than the .ts, and displays solid black in mpc-hc.

Ffmpeg seems to be complaining about corruption, though again the .ts files play fine. Is there some way to use ffmpeg to convert these files to mkv? Or do I need to capture them differently somehow?

Thanks!

mbassiouny 04-09-2025 06:30 PM

You do not specify what you want to do. Do you just want to change .ts to .mkv for fun? for playback issues? trying to compress the files for storage? re-encoding for (web) distribution?

"Ffmpeg won't convert VHS captured .ts to .mkv"

Is actually a weird way to ask your question. It's simply "Ffmpeg won't convert .ts to .mkv". FFmpeg does not care where that .TS came from. Your .ts being a vhs transfer does not make it special, it's just a .ts file and the question is a simple format transfer question that has nothing to do with analog and vhs capture.

> the .ts files play well, with no sign of corruption.
With no sign of corruption to your naked eye. How do you know for sure there is no corruption?

> The resulting mkv file is much smaller than the .ts,
I am not sure that makes sense... you're using "copy" so if your codec is compatible with the mkv container ffmpeg is supposed just "re-mux" the same video just in an mkv container with ~almost the same size.

Try using a more explicit command chose you codec, specify that the source is interlaced if it is, etc or use a gui encoder like https://sourceforge.net/projects/x26....8.7z/download if you're not familiar with FFmpeg CLI commands (or find an ffmpeg GUI)

traal 04-10-2025 05:51 PM

You might use MediaInfo to inspect the input and output files to see what's different other than the container itself.

It's possible that the output file is perfectly good but mpc-hc just doesn't know how to play it.

You could try converting the .ts to HuffYUV and see if you can open it in VirtualDub:

Code:

ffmpeg -i test.ts -acodec copy -vcodec huffyuv test.avi
But you should capture directly to HuffYUV because it's lossless and it will give you a greater ability to restore the video.

fredvhs 04-14-2025 09:54 AM

Thanks for the replies. I want to transmux from .ts container to mkv, because with my players (Mediaportal and mpc-hc) mkv's navigate (skip, fforward, rewind) better than ts's. And they're slightly smaller.

The original .ts file is tff interlaced - here's the MediaInfo output (ignoring the audio stream):
Code:

General
ID                                      : 4 (0x4)
Complete name                            : short.ts
Format                                  : MPEG-TS
File size                                : 102 MiB
Duration                                : 2 min 54 s
Overall bit rate mode                    : Variable
Overall bit rate                        : 4 889 kb/s
Frame rate                              : 29.970 FPS

Video
ID                                      : 48 (0x30)
Menu ID                                  : 137 (0x89)
Format                                  : AVC
Format/Info                              : Advanced Video Codec
Format profile                          : Main@L3.2
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                  : Yes
Format settings, Reference frames        : 2 frames
Format settings, GOP                    : M=3, N=15
Codec ID                                : 27
Duration                                : 2 min 54 s
Width                                    : 720 pixels
Height                                  : 480 pixels
Display aspect ratio                    : 4:3
Frame rate                              : 29.970 (30000/1001) FPS
Standard                                : NTSC
Color space                              : YUV
Chroma subsampling                      : 4:2:0
Bit depth                                : 8 bits
Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                              : Top Field First

I want to do this losslessly, so the mkv has to be interlaced. When I try to losslessly convert to mkv with the command
Code:

ffmpeg -i test.ts -codec copy test.mkv
test.mkv is about 4% the filesize of test.ts, so clearly the video stream hasn't been copied. MediaInfo on test.mkv gives:
Code:

General
Unique ID                                : 324606370689798789122356525188404692766 (0xF434E9B6C40AEE5451D4E55EC71F471E)
Complete name                            : short2.mkv
Format                                  : Matroska
Format version                          : Version 4
File size                                : 3.87 MiB
Duration                                : 2 min 54 s
Overall bit rate                        : 186 kb/s
Frame rate                              : 29.970 FPS
Writing application                      : Lavf61.7.100
Writing library                          : Lavf61.7.100
ErrorDetectionType                      : Per level 1

Video
ID                                      : 1
Format                                  : AVC
Format/Info                              : Advanced Video Codec
Format profile                          : Main@L3.2
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                  : Yes
Format settings, Reference frames        : 2 frames
Codec ID                                : V_MPEG4/ISO/AVC
Width                                    : 720 pixels
Height                                  : 480 pixels
Display aspect ratio                    : 4:3
Frame rate mode                          : Constant
Frame rate                              : 29.970 (30000/1001) FPS
Standard                                : NTSC
Color space                              : YUV
Chroma subsampling                      : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan type, store method                  : Separated fields (2 fields per block)
Scan order                              : Top Field First
Default                                  : No
Forced                                  : No

I've tried to specify tff interlacing with the command:
Code:

ffmpeg -i test.ts -codec copy -flags +ilme+ildct -top 1 -x264opts tff=1 test.mkv
and that gives file test.mkv of the same size as the previous ffmpeg command and with the same MediaInfo output. In other words it doesn't work.

I've also transcoded with command:
Code:

ffmpeg -i test.ts -vf yadif test.mkv
The result test.mkv is progressive and plays fine. But again I'd like to do this losslessly.

mbassiouny 04-14-2025 11:14 AM

use mkvmergeGUI (mkvtoolnix).
Just drag and drop the .ts into the tool then "stat multiplexing"you will get an mkv output.

Try mpv for playback of the ts files, they usually seek fine.


Quote:

because with my players (Mediaportal and mpc-hc) mkv's navigate (skip, fforward, rewind) better than ts's.
I don't think this is always true.
MPC-HC can play ts and navigate perfectly if the ts is seekable from my experience...

Maybe just a mere format conversion will solve the problem for u, maybe not. IDK

Some videos are just not very seekable (and there are many possible reasons behind it) so this may force you to re-transcode.

fredvhs 04-14-2025 12:11 PM

Quote:

Originally Posted by mbassiouny (Post 102330)
use mkvmergeGUI (mkvtoolnix).
Just drag and drop the .ts into the tool then "stat multiplexing"you will get an mkv output.

Thanks again. Mkvmerge (GUI or CLI) gives a similar result to ffmpeg - .mkv file is around 4% the filesize of the .ts file and won't play.

vwestlife 04-14-2025 02:43 PM

What happens when you transmux them into .MP4 files? That is generally the most universally compatible container for AVC (H.264) video.

fredvhs 04-14-2025 04:32 PM

Quote:

Originally Posted by vwestlife (Post 102333)
What happens when you transmux them into .MP4 files? That is generally the most universally compatible container for AVC (H.264) video.

I get exactly the same result with mp4 as when I try transmux to mkv: tiny filesize and no video on playback.

mbassiouny 04-14-2025 04:47 PM

probably your source is corrupted and every software that tries to remux it fails after a few frames.

care to share the file?

fredvhs 04-16-2025 02:03 PM

Well ffprobe/ffmpeg does report numerous "Packet corrupt" messages as I mentioned above. Still it seems odd that a deinterlaced transcode succeeds, giving a playable mkv file without obvious corruption, using the command:
Code:

ffmpeg -i test.ts -vf yadif test.mkv
Anyway I see this forum doesn't allow .ts file attachments. So I've posted to my web server a sample ts file captured directly from vhs via the colossus capture card - you can download it from https://lcdm.ca/files/test.ts.


All times are GMT -5. The time now is 03:19 PM

Site design, images and content © 2002-2026 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2026 Jelsoft Enterprises Ltd.