Shotcut doesn't correctly export video using .ts file format to .mp4

Right running into a lot of bugs of later in shotcut, which is concerning if you want to use the editor for more complex videos.

Today I tried exporting a raw elgato gaming HD .ts video capture file via shotcut and sadly it appears. That Shotcut doesn’t correctly work with the format.

It can import the video fine and the play back in the editor is fine, however on export a heavy stutter is added to the video. I’m using my normal options and set up so this issues shouldn’t be occurring only change is the file type I am using. normally I work with mp4. Seeing as I saw shotcut supported .ts I decided to try a raw edit rather than exporting to mp4, before editing. If shotcut didn’t support the format it shouldn’t allow import.

Only way to get around this I found was to have a program like handbrake export the video first, which defeats the point of me using raw files in the first place.

Tested in Shotcut version 19.04.30 (latest as of submitting) I’m on Windows 7, 64 bit OS

Video of the stutter/jumping added after export:

I don’t have any solutions. Sadly, I can only corroborate your experience. Bear in mind that Shotcut is built on top of ffmpeg. Decoding issues like you’re experiencing are probably from ffmpeg, not Shotcut. I have had very sketchy experiences working with .TS and .MTS files even directly with ffmpeg, so I would expect those problems to ripple up to Shotcut. It’s so bad that I have an ingest process that converts .TS and .MTS to an intermediate format with the -async 1 -vsync cfr ffmpeg options to eliminate the stutter. Transcoding like you’re doing with HandBrake is the only fool-proof solution I’ve found so far. There are lossless formats like FFV1, HuffYUV, and Ut Video if you’re concerned about preserving absolute video quality. Those transcodes won’t cost you anything except time.

The alternative, of course, would be capturing in a format other than .TS if possible.

1 Like

Shotcut is known to have problems with HDV, which is HD MPEG-2 with B-frames and typically with something called open GOP, which is very difficult for editing. Since that is a legacy format, we are not giving it further attention. I do not know anything about your file format as you did not provide details and I do not have this device. More than likely, you just need to convert if you want to work with it. You can supply a sample if you’d like, and I’ll take a look but make no promises.

Only way to get around this

You can also use the Convert function in Shotcut Properties panel after opening the file.

1 Like

OK if this is a none support legacy format, then really shotcut should not allow import of this type of file or display a warning on import. As it is at present it appeared it would work, normally I use mp4. But seeing as it looked like shotcut supported the raw format it save me a lot of time not exporting to mp4 and would give a better video quality video overall. By default elgato devices capture at .ts, before exporting to .mp4, cutting out the .mp4 export looked like a good idea, but seems it wasn’t.

Happy to provide a sample of this .TS file, you’ll need to download it in the next day or two as this isn’t a small upload. Just say what you need and i’ll provide it: raw video in this file is here 740x480 resolution and 60fps NTSC capture: [Link removed no longer needed]

Word of warning the video file is around 900MB

I used software encoding as normal as well for export. I’ll try the convert feature, as I did a 45 minute video with .ts multiple file and I don’t want to have to have to restart the whole project.

This sounded like a curious issue, so I downloaded the 900MB file - thank you for providing it.

I exported 1 minute (1080p30fps) and it had only one jump during the first second. http://www.mediafire.com/file/6g229bulgiza642/ts.mp4/file

I exported 30 seconds (1080p60fps), it didn’t have the jump in the first second or any others (it didn’t get to gameplay though). http://www.mediafire.com/file/04y7t54ru7yi5jp/ts2.mp4/file

I used HandBrake 1.2.2 to convert the source video and it seems to be totally ok: http://www.mediafire.com/file/t7o2axs12olbqbt/conv.mp4/file

You could try avidemux as well claims a redditor over here https://www.reddit.com/r/ElgatoGaming/comments/9ipjub/help_converting_ts_files_to_mp4/

Watch out: handbrake might automatically change fps to 30fps, change it in the VIDEO tab to 60 or ‘same as source’

You can then hopefully use the same shotcut project with the new file. You can simply rename the TS file from c:\here\file.ts to c:\here\fileORIGINAL.ts and rename the c:\handbrakeoutput\file.mp4 to c:\here\file.ts or you can edit the project file to replace the file used by each clip using the video game file. Make sure to make a backup in that case.

One of these methods (file swap + handbrake) is used in this video too:

OK, qubodup can you read my first post and follow up post fully, I have edited a large number of videos using shotcut and you can see the channel I work on here: https://www.youtube.com/c/RandomisedGamingYouTube

I think you assume I’m a beginner editor when I’m not. We do 4K videos these days in shotcut and have to work with various frames rates with games from, 20,30,50,59,50 on top of various resolutions used by different consoles from all eras in PAL and NTSC. Both 16:9 and 4:3, which have meant I’ve had to set up a number of custom resolutions, I doubt many people used the 4k 4:3 resolution of 2880 x 2160p these days.

I have already explained I can reconvert them using handbrake or just using the MP4 exporter on elgato. You seems very eager to help, which I thank you for, but you have largely just reposted everything I mentioned in my second post in a bit of a haste to help.

I am well aware of how I can fix this problem, via exporting the video to a mp4. I was just hoping this time around I could use the raw master files to improve video quality. Converting them to mp4 isn’t a problem it’s how I normally do videos.

Here’s the most recent video I did with .mp4 file:

We recently upgraded to an open source scan converter which improved video capture and I thought rather than use the mp4 export from the elgato I would use the .ts master file. My mistake was not doing a test export on the .ts file until after building my latest video. I made the mistake of assuming that because I could import .ts files into shotcut, they would export correctly and we know what assumption can make you, which is my fault for not double checking.

The trouble is the fix is going to take me a lot of time and I’d rather shortcut just be able to export .ts file. If it can’t then I will have to convert everything back to mp4 again.

From what I can tell, ts is a container for MPEG-2 compressed video data. As such, have tried converting the video upon import to mkv so it’s uncompressed and in high quality?

Quick update, but the Convert to Edit-friendly option in the properties panel, doesn’t appear to like .ts files in the slightest. Tried it three times using all options and just got a failed job icon, each time. So that was .mp4, .mov and .mkv all failed and I tried a range of .ts clips

So for this smaller clip I converted it to .mp4 via handbrake yesterday and then upscaled it in shotcut and resized it to remove the borders. Which is how I normally do a lot of my videos, this ensures the stutter is removed:

Sadly this footage is is a small sample of what I have in a bigger project of a look at 20+ SNES titles, that lasts about 45 minutes. I’m going to build it with a lower resolution and see how much skipping occurs with all the different ts files. Strangely the R-Type 3 footage is one of the worse a test sample of some of the other footage didn’t skip.

This will be the only project I ever use the raw .ts files for in shortcut I’ll just stick with .mp4 files in future, unless you guys are able to add a fix in at a later date, but as this is a legacy issue, I won’t expect any type of fix. I would just suggest a warning message is added to displayed on unsupported formats import into shotcut.

I’ve also uploaded an additional .ts file sample this one is from a different SNES game that isn’t as fast paced as the last: [Link removed no longer needed]

That is a bit surprising as it simply runs ffmpeg command line. After you choose it, you can look in View > Application Log to see the command line it generates. ffmpeg utility is more accommodating than Shotcut since it only needs to sequential processing and is less demanding on seeking. Also, keep in mind that .ts (MPEG-2 Transport Stream) can contain different codecs with streams coded in different ways, and not all .ts files are going to have the same problem (except perhaps those from there same device or tool configuration).

Right this is the last few lines I get from the View > Application Log after using the Convert to Edit-friendly.

Export 1 error log:

[Debug ] <TimelineDock::setSelection> Changing selection to () trackIndex -1 isMultitrack true

[Info ] <MainWindow::open> "C:\Users\James\Documents\Randomised Gaming\Video work in progress\OSSC SNES\ossc_snes.mlt"

[Info ] <MLT> Failed to open audio device: XAudio2: XAudio2Create() failed at open.

[Info ] <MLT> [sdl2] Try alternative driver: xaudio2

[Info ] <MLT> [consumer sdl2_audio] Audio Opened: driver=xaudio2 channels=2 frequency=48000

[Debug ] <TimelineDock::setSelection> Changing selection to () trackIndex -1 isMultitrack false

[Debug ] <TimelineDock::setSelection> Changing selection to (3) trackIndex -1 isMultitrack false

[Debug ] <MLT> [producer avformat] audio: total_streams 12 max_stream 13 total_channels 24 max_channels 2

[Debug ] <MLT> [mlt_producer avformat-novalidate] "I:/Elgato Game Capture Footage/EGC_Library/OSSC - OSSC Test Axelay SNES - 2019-04-30 16-56-56/Recording_2019-04-30_16-56-56_0001.ts" checking VFR: pkt.duration %I64d

[Debug ] <FfmpegJob::start> "C:/Program Files/Shotcut/ffmpeg -loglevel verbose -i I:/Elgato Game Capture Footage/EGC_Library/OSSC - OSSC Test Axelay SNES - 2019-04-30 16-56-56/Recording_2019-04-30_16-56-56_0001.ts -map 0:V? -map 0:a -map_metadata 0 -ignore_unknown -f mov -codec:a alac -codec:v prores_ks -profile:v standard -y C:/Users/James/Desktop/Recording_2019-04-30_16-56-56_0001.mov"

[Info ] <AbstractJob::onFinished> job failed with 1

Export 2 error log:

[Debug ] <TimelineDock::setSelection> Changing selection to (7) trackIndex -1 isMultitrack false

[Debug ] <MLT> [producer avformat] audio: total_streams 12 max_stream 13 total_channels 24 max_channels 2

[Debug ] <MLT> [mlt_producer avformat-novalidate] "I:/Elgato Game Capture Footage/EGC_Library/OSSC - OSSC Test Axelay SNES - 2019-04-30 16-56-56/Recording_2019-04-30_16-56-56_0001.ts" checking VFR: pkt.duration %I64d

[Debug ] <TimelineDock::setSelection> Changing selection to (16) trackIndex -1 isMultitrack false

[Debug ] <MLT> [producer avformat] audio: total_streams 12 max_stream 13 total_channels 24 max_channels 2

[Debug ] <MLT> [mlt_producer avformat-novalidate] "I:/Elgato Game Capture Footage/EGC_Library/OSSC - OSSC Test R-Type III SFC - 2019-05-01 12-03-58/Recording_2019-05-01_12-03-58_0001.ts" checking VFR: pkt.duration %I64d

[Debug ] <FfmpegJob::start> "C:/Program Files/Shotcut/ffmpeg -loglevel verbose -i I:/Elgato Game Capture Footage/EGC_Library/OSSC - OSSC Test R-Type III SFC - 2019-05-01 12-03-58/Recording_2019-05-01_12-03-58_0001.ts -map 0:V? -map 0:a -map_metadata 0 -ignore_unknown -f matroska -codec:a flac -codec:v ffv1 -coder 1 -context 1 -g 1 -threads 8 -y C:/Users/James/Desktop/Recording_2019-05-01_12-03-58_0001.mkv"

[Info ] <AbstractJob::onFinished> job failed with 1

If you need any more samples let me know, I should test this on a clip I expect it to work on just to be sure, it is working on my machine OK.

I downloaded your clip. So, you can remove it now. It is not like the HDV format I mentioned in my first reply. The conversion job fails with the error
Too many packets buffered for output stream 0:0.

This is a frequently encountered ffmpeg error.
https://trac.ffmpeg.org/ticket/6375
https://ffmpeg-devel.ffmpeg.narkive.com/zBdqFxtJ/ticket-6375-too-many-packets-buffered-for-output-stream

There is no universal solution for this yet. I made a change by adding a command line option to workaround the majority of this kind of failure, and it seems to work at first as it makes some progress but eventually fails with the same error. After adding -max_muxing_queue_size 99999 (much larger than default), it gets to 100% but then fails with a 0 byte file and

Cannot determine format of input stream 0:1 after EOF
Error marking filters as finished

Next, I tried to reproduce your reported problem with an unsmooth export result using the ts, but I did not with a simple project. It might be something in your project exacerbating things, and perhaps if you turn off Export > Advanced > Video > Parallel processing the problem will go away.

2 Likes

Oddly the R-Type III, clip wouldn’t export correctly even just on its own with a bit of trimming.

Really good news is that it did export the clip correctly when parallel processing was turned off, so thank you, that seems to resolve the issue I am having with .ts files on export. In future I’ll just stick to the .mp4 I normally do, but yes it seems parallel process is the issue in this case.

I’ll let you known the results on the larger project when I can export it. Hopefully should be start of next week.

So I also noticed that for some reason that the Elgato software itself is having problems exporting some files captured via an Open Source Scan Converter to mp4. I’m wondering if the way the OSSC displays video over hdmi is causing part of the problem as it does so in a bit of a none standard format.

Noticed it with the raw capture footage for this video I did this week from a Sega Saturn, however editing in shotcut with parallel turn off resulted in no skipping or errors:

Well project is now up, sadly I did have to chop the video in two, however, I tried to merge the two clips together, but even with parallel progressing on, it was going to take longer that the original 2 exports where I had it off first time.

Which suggests something might be wrong with the export of larger videos in shotcut at present as a quick splice together of two .mp4 clips should be fairly quick in comparison to the original export. Filters slow export down hugely, but when not our on and it’s taking longer, didn’t seem right. Certainly Shotcut seems slower these days on certain types of export.

I have wondered if a memory leak, might have got into the export system. I’d do a proper bug write up another time

Final video part 1:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.