Sponsored Links:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mpeg2.ts workaround for Linux/Unix using ffmpeg
#1
I wanted to share this solution and little script that I have made to remux mpeg2 files with a ts extension to mp4 as I have found that mpeg2 files will not play in Kodi properly without buying a codec. I can confirm that the resulting files work for me in Kodi 16.1 on a RPi2 running arch Linux ARM.

I have used ffmpeg and written a short script using a loop to remux all files contained in a folder from mpeg2.ts to mp4.

If you don't have ffmpeg you can install it as a command line tool in OS X using homebrew or on Linux using your package manager of choice.

For an individual file you can just use a single command

Code:
ffmpeg -i /PATH/TO/CONTAINING/FOLDER/S03E01.ts -acodec copy -vcodec copy /PATH/TO/DESTINATION/FOLDER/S03E01.mp4

If you have multiple files that need converting then you can put them in a folder and run this script, just change the path to containing folder in the script.

Code:
#!/bin/bash
# convert mpeg2-ts files to mp4
cd /PATH/TO/FOLDER/
for a in *.ts ; do
f="${a[@]/%ts/mp4}"
ffmpeg -i "$a" -acodec copy -vcodec copy "$f"
sleep 20
done


Hope this helps someone out

Mods please feel free to move if in the wrong place. Your also welcome to share this script wherever you like Smile
Raspberry Pi 2 Model B

arch Linux ARM

Kodi setup - Kodi-rbp 16.1-4 / omxplayer-git 494.791d7df-1 / xorg-xrefresh 1.0.5-1 / xorg-xset 1.2.3-1

A few other packages I use a lot - nfs-utils / libtorrent / rtorrent / weechat / vim / bitlbee / newsbeuter / mutt / python2 + 3
  Reply
Sponsored Links:
#2
That's a great solution, thanks for posting.

As far as I'm aware it's only applicable to raspberry pi units, fairly sure every other device comes with the ability to play those files?

However it's really useful info, well done.
WANT TO SHOW YOUR APPRECIATION?
A thank you is really all that's needed but if you want to buy me a drink then who am I to argue!

[Image: 11i3ihd.jpg]
  Reply
#3
(08-26-2016, 01:23 PM)whufclee Wrote: That's a great solution, thanks for posting.

As far as I'm aware it's only applicable to raspberry pi units, fairly sure every other device comes with the ability to play those files?

However it's really useful info, well done.

Thanks Smile

I also had the same issue with my droid boxes but the mpeg2-ts files play fine on my OS X version of Kodi 16.1
Raspberry Pi 2 Model B

arch Linux ARM

Kodi setup - Kodi-rbp 16.1-4 / omxplayer-git 494.791d7df-1 / xorg-xrefresh 1.0.5-1 / xorg-xset 1.2.3-1

A few other packages I use a lot - nfs-utils / libtorrent / rtorrent / weechat / vim / bitlbee / newsbeuter / mutt / python2 + 3
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)