1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
|
%global _empty_manifest_terminate_build 0
Name: python-jellyfin-mpv-shim
Version: 2.6.0
Release: 1
Summary: Cast media from Jellyfin Mobile and Web apps to MPV.
License: GPLv3
URL: https://github.com/jellyfin/jellyfin-mpv-shim
Source0: https://mirrors.aliyun.com/pypi/web/packages/e7/bf/e59af46495947728548cf82aafcc283c7e9f7df4e47f1bdbb8cb890abfde/jellyfin-mpv-shim-2.6.0.tar.gz
BuildArch: noarch
Requires: python3-jellyfin-apiclient-python
Requires: python3-mpv
Requires: python3-mpv-jsonipc
Requires: python3-requests
Requires: python3-Jinja2
Requires: python3-pillow
Requires: python3-pypresence
Requires: python3-pystray
Requires: python3-pywebview
Requires: python3-pypresence
Requires: python3-pillow
Requires: python3-pystray
Requires: python3-Jinja2
Requires: python3-pywebview
%description
# Jellyfin MPV Shim
[](https://github.com/jellyfin/jellyfin-mpv-shim/releases)
[](https://pypi.org/project/jellyfin-mpv-shim/)
[](https://translate.jellyfin.org/projects/jellyfin/jellyfin-mpv-shim/)
[](https://github.com/psf/black)
Jellyfin MPV Shim is a cross-platform cast client for Jellyfin.
It has support for all your advanced media files without transcoding, as well as tons of
features which set it apart from other multimedia clients:
- Direct play most media using MPV.
- Watch videos with friends using SyncPlay.
- Offers a shim mode which runs in the background.
- The Jellyfin mobile apps can fully control the client.
- [Reconfigure subtitles](https://github.com/jellyfin/jellyfin-mpv-shim#menu) for an entire season at once.
- Supports all of the [MPV keyboard shortcuts](https://github.com/jellyfin/jellyfin-mpv-shim#keyboard-shortcuts).
- Enhance your video with [Shader Packs](https://github.com/jellyfin/jellyfin-mpv-shim#menu) and [SVP Integration](https://github.com/jellyfin/jellyfin-mpv-shim#svp-integration).
- Optionally share your media activity with friends using Discord Rich Presence.
- Most features, as well as MPV itself, [can be extensively configured](https://github.com/jellyfin/jellyfin-mpv-shim#configuration).
- You can configure the player to use an [external MPV player](https://github.com/jellyfin/jellyfin-mpv-shim#external-mpv) of your choice.
- Enable a chromecast-like experience with [Display Mirroring](https://github.com/jellyfin/jellyfin-mpv-shim#display-mirroring).
- You can [trigger commands to run](https://github.com/jellyfin/jellyfin-mpv-shim#shell-command-triggers) when certain events happen.
To learn more, keep reading. This README explains everything, including [configuration](https://github.com/jellyfin/jellyfin-mpv-shim#configuration), [tips & tricks](https://github.com/jellyfin/jellyfin-mpv-shim#tips-and-tricks), and [development information](https://github.com/jellyfin/jellyfin-mpv-shim#development).
## Getting Started
If you are on Windows, simply [download the binary](https://github.com/jellyfin/jellyfin-mpv-shim/releases).
If you are using Linux, you can [install via flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim) or [install via pip](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#linux-installation). If you are on macOS, see the [macOS Installation](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#osx-installation)
section below.
To use the client, simply launch it and log into your Jellyfin server. You’ll need to enter the
URL to your server, for example `http://server_ip:8096` or `https://secure_domain`. Make sure to
include the subdirectory and port number if applicable. You can then cast your media
from another Jellyfin application.
The application runs with a notification icon by default. You can use this to edit the server settings,
view the application log, open the config folder, and open the application menu. Unlike Plex MPV Shim,
authorization tokens for your server are stored on your device, but you are able to cast to the player
regardless of location.
Note: Due to the huge number of questions and issues that have been submitted about URLs, I now tolerate
bare IP addresses and not specifying the port by default. If you want to connect to port 80 instead of
8096, you must add the `:80` to the URL because `:8096` is now the default.
## Limitations
- Music playback and Live TV are not supported.
- The client can’t be shared seamlessly between multiple users on the same server. ([Link to issue.](https://features.jellyfin.org/posts/319/mark-device-as-shared))
### Known Issues
Please also note that the on-screen controller for MPV (if available) cannot change the
audio and subtitle track configurations for transcoded media. It also cannot load external
subtitles. You must either [use the menu](https://github.com/jellyfin/jellyfin-mpv-shim#menu) or the application you casted from.
Please note the following issues with controlling SyncPlay:
- If you attempt to join a SyncPlay group when casting to MPV Shim, it will play the media but it will not activate SyncPlay.
- You can, however, proceed to activate SyncPlay [using the menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- If you would like to create a group or join a group for currently playing media, [use menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- SyncPlay as of 10.7.0 is new and kind of fragile. You may need to rejoin or even restart the client. Please report any issues you find.
Music playback sort-of works, but repeat, shuffle, and gapless playback have not been implemented and
would require major changes to the application to properly support, as it was built for video.
The shader packs feature is sensitive to graphics hardware. It may simply just not work on your computer.
You may be able to use the log files to get some more diagnostic information. If you're really unlucky,
you'll have to disable the feature by pressing `k` to restore basic functionality.
If you find the solution for your case, *please* send me any information you can provide, as every test case helps.
## Advanced Features
### Menu
To open the menu, press **c** on your computer or use the navigation controls
in the mobile/web app.
The menu enables you to:
- Adjust video transcoding quality.
- Change the default transcoder settings.
- Change subtitles or audio, while knowing the track names.
- Change subtitles or audio for an entire series at once.
- Mark the media as unwatched and quit.
- Enable and disable SyncPlay.
- Configure shader packs and SVP profiles.
- Take screenshots.
On your computer, use the mouse or arrow keys, enter, and escape to navigate.
On your phone, use the arrow buttons, ok, back, and home to navigate.
### Shader Packs
Shader packs are a recent feature addition that allows you to easily use advanced video
shaders and video quality settings. These usually require a lot of configuration to use,
but MPV Shim's default shader pack comes with [FSRCNNX](https://github.com/igv/FSRCNN-TensorFlow)
and [Anime4K](https://github.com/bloc97/Anime4K) preconfigured. Try experimenting with video
profiles! It may greatly improve your experience.
Shader Packs are ready to use as of the most recent MPV Shim version. To use, simply
navigate to the **Video Playback Profiles** option and select a profile.
For details on the shader settings, please see [default-shader-pack](https://github.com/iwalton3/default-shader-pack).
If you would like to customize the shader pack, there are details in the configuration section.
### SVP Integration
SVP integration allows you to easily configure SVP support, change profiles, and enable/disable
SVP without having to exit the player. It is not enabled by default, please see the configuration
instructions for instructions on how to enable it.
### Display Mirroring
This feature allows media previews to show on your display before you cast the media,
similar to Chromecast. It is not enabled by default. To enable it, do one of the following:
- Using the systray icon, click "Application Menu". Go to preferences and enable display mirroring.
- Use the arrow keys, escape, and enter to navigate the menu.
- Cast media to the player and press `c`. Go to preferences and enable display mirroring.
- In the config file (see below), change `display_mirroring` to `true`.
Then restart the application for the change to take effect. To quit the application on Windows with
display mirroring enabled, press Alt+F4.
### Keyboard Shortcuts
This program supports most of the [keyboard shortcuts from MPV](https://mpv.io/manual/stable/#interactive-control). The custom keyboard shortcuts are:
- < > to skip episodes
- q to close player
- w to mark watched and skip
- u to mark unwatched and quit
- c to open the menu
- k disable shader packs
Here are the notable MPV keyboard shortcuts:
- space - Pause/Play
- left/right - Seek by 5 seconds
- up/down - Seek by 1 minute
- s - Take a screenshot
- S - Take a screenshot without subtitles
- f - Toggle fullscreen
- ,/. - Seek by individual frames
- \[/\] - Change video speed by 10%
- {/} - Change video speed by 50%
- backspace - Reset speed
- m - Mute
- d - Enable/disable deinterlace
- Ctrl+Shift+Left/Right - Adjust subtitle delay.
## Configuration
The configuration file is located in different places depending on your platform. You can also open the
configuration folder using the systray icon if you are using the shim version. When you launch the program
on Linux or macOS from the terminal, the location of the config file will be printed. The locations are:
- Windows - `%appdata%\jellyfin-mpv-shim\conf.json`
- Linux - `~/.config/jellyfin-mpv-shim/conf.json`
- Linux (Flatpak) - `~/.var/app/com.github.iwalton3.jellyfin-mpv-shim/config/jellyfin-mpv-shim/conf.json`
- macOS - `~/Library/Application Support/jellyfin-mpv-shim/conf.json`
- CygWin - `~/.config/jellyfin-mpv-shim/conf.json`
You can specify a custom configuration folder with the `--config` option.
### Transcoding
You can adjust the basic transcoder settings via the menu.
- `always_transcode` - This will tell the client to always transcode. Default: `false`
- This may be useful if you are using limited hardware that cannot handle advanced codecs.
- Please note that Jellyfin may still direct play files that meet the transcode profile
requirements. There is nothing I can do on my end to disable this, but you can reduce
the bandwidth setting to force a transcode.
- `transcode_hdr` - Force transcode HDR videos to SDR. Default: `false`
- `transcode_dolby_vision` - Force transcode Dolby Vision videos to SDR. Default: `true`
- If your computer can handle it, you can get tone mapping to work for this using `vo=gpu-next`.
- Note that `vo=gpu-next` is considered experimental by MPV at this time.
- `transcode_hi10p` - Force transcode 10 bit color videos to 8 bit color. Default: `false`
- `remote_kbps` - Bandwidth to permit for remote streaming. Default: `10000`
- `local_kbps` - Bandwidth to permit for local streaming. Default: `2147483`
- `direct_paths` - Play media files directly from the SMB or NFS source. Default: `false`
- `remote_direct_paths` - Apply this even when the server is detected as remote. Default: `false`
- `allow_transcode_to_h265` - Allow the server to transcode media *to* `hevc`. Default: `false`
- If you enable this, it'll allow remuxing to HEVC but it'll also break force transcoding of Dolby Vision and HDR content if those settings are used. (See [this bug](https://github.com/jellyfin/jellyfin/issues/9313).)
- `prefer_transcode_to_h265` - Requests the server to transcode media *to* `hevc` as the default. Default: `false`
- `transcode_warning` - Display a warning the first time media transcodes in a session. Default: `true`
- `force_video_codec` - Force a specified video codec to be played. Default: `null`
- This can be used in tandem with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
- This will override `transcode_to_h265`, `transcode_h265` and `transcode_hi10p`.
- `force_audio_codec` - Force a specified audio codec to be played. Default: `null`
- This can be used in tandeom with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
### Features
You can use the config file to enable and disable features.
- `fullscreen` - Fullscreen the player when starting playback. Default: `true`
- `enable_gui` - Enable the system tray icon and GUI features. Default: `true`
- `enable_osc` - Enable the MPV on-screen controller. Default: `true`
- It may be useful to disable this if you are using an external player that already provides a user interface.
- `media_key_seek` - Use the media next/prev keys to seek instead of skip episodes. Default: `false`
- `use_web_seek` - Use the seek times set in Jellyfin web for arrow key seek. Default: `false`
- `display_mirroring` - Enable webview-based display mirroring (content preview). Default: `false`
- `screenshot_menu` - Allow taking screenshots from menu. Default: `true`
- `check_updates` - Check for updates via GitHub. Default: `true`
- This requests the GitHub releases page and checks for a new version.
- Update checks are performed when playing media, once per day.
- `notify_updates` - Display update notification when playing media. Default: `true`
- Notification will only display once until the application is restarted.
- `discord_presence` - Enable Discord rich presence support. Default: `false`
- `menu_mouse` - Enable mouse support in the menu. Default: `true`
- This requires MPV to be compiled with lua support.
### Shell Command Triggers
You can execute shell commands on media state using the config file:
- `media_ended_cmd` - When all media has played.
- `pre_media_cmd` - Before the player displays. (Will wait for finish.)
- `stop_cmd` - After stopping the player.
- `idle_cmd` - After no activity for `idle_cmd_delay` seconds.
- `idle_when_paused` - Consider the player idle when paused. Default: `false`
- `stop_idle` - Stop the player when idle. (Requires `idle_when_paused`.) Default: `false`
- `play_cmd` - After playback starts.
- `idle_ended_cmd` - After player stops being idle.
### Subtitle Visual Settings
These settings may not works for some subtitle codecs or if subtitles are being burned in
during a transcode. You can configure custom styled subtitle settings through the MPV config file.
- `subtitle_size` - The size of the subtitles, in percent. Default: `100`
- `subtitle_color` - The color of the subtitles, in hex. Default: `#FFFFFFFF`
- `subtitle_position` - The position (top, bottom, middle). Default: `bottom`
### External MPV
The client now supports using an external copy of MPV, including one that is running prior to starting
the client. This may be useful if your distribution only provides MPV as a binary executable (instead
of as a shared library), or to connect to MPV-based GUI players. Please note that SMPlayer exhibits
strange behaviour when controlled in this manner. External MPV is currently the only working backend
for media playback on macOS.
- `mpv_ext` - Enable usage of the external player by default. Default: `false`
- The external player may still be used by default if `libmpv1` is not available.
- `mpv_ext_path` - The path to the `mpv` binary to use. By default it uses the one in the PATH. Default: `null`
- If you are using Windows, make sure to use two backslashes. Example: `C:\\path\\to\\mpv.exe`
- `mpv_ext_ipc` - The path to the socket to control MPV. Default: `null`
- If unset, the socket is a randomly selected temp file.
- On Windows, this is just a name for the socket, not a path like on Linux.
- `mpv_ext_start` - Start a managed copy of MPV with the client. Default: `true`
- If not specified, the user must start MPV prior to launching the client.
- MPV must be launched with `--input-ipc-server=[value of mpv_ext_ipc]`.
- `mpv_ext_no_ovr` - Disable built-in mpv configuration files and use user defaults.
- Please note that some scripts and settings, such as ones to keep MPV open, may break
functionality in MPV Shim.
### Keyboard Shortcuts
You can reconfigure the custom keyboard shortcuts. You can also set them to `null` to disable the shortcut. Please note that disabling keyboard shortcuts may make some features unusable. Additionally, if you remap `q`, using the default shortcut will crash the player.
- `kb_stop` - Stop playback and close MPV. (Default: `q`)
- `kb_prev` - Go to the previous video. (Default: `<`)
- `kb_next` - Go to the next video. (Default: `>`)
- `kb_watched` - Mark the video as watched and skip. (Default: `w`)
- `kb_unwatched` - Mark the video as unwatched and quit. (Default: `u`)
- `kb_menu` - Open the configuration menu. (Default: `c`)
- `kb_menu_esc` - Leave the menu. Exits fullscreen otherwise. (Default: `esc`)
- `kb_menu_ok` - "ok" for menu. (Default: `enter`)
- `kb_menu_left` - "left" for menu. Seeks otherwise. (Default: `left`)
- `kb_menu_right` - "right" for menu. Seeks otherwise. (Default: `right`)
- `kb_menu_up` - "up" for menu. Seeks otherwise. (Default: `up`)
- `kb_menu_down` - "down" for menu. Seeks otherwise. (Default: `down`)
- `kb_pause` - Pause. Also "ok" for menu. (Default: `space`)
- `kb_fullscreen` - Toggle fullscreen. (Default: `f`)
- `kb_debug` - Trigger `pdb` debugger. (Default: `~`)
- `kb_kill_shader` - Disable shader packs. (Default: `k`)
- `seek_up` - Time to seek for "up" key. (Default: `60`)
- `seek_down` - Time to seek for "down" key. (Default: `-60`)
- `seek_right` - Time to seek for "right" key. (Default: `5`)
- `seek_left` - Time to seek for "left" key. (Default: `-5`)
- `media_keys` - Enable binding of MPV to media keys. Default: `true`
- `seek_v_exact` - Use exact seek for up/down keys. Default: `false`
- `seek_h_exact` - Use exact seek for left/right keys. Default: `false`
### Shader Packs
Shader packs allow you to import MPV config and shader presets into MPV Shim and easily switch
between them at runtime through the built-in menu. This enables easy usage and switching of
advanced MPV video playback options, such as video upscaling, while being easy to use.
If you select one of the presets from the shader pack, it will override some MPV configurations
and any shaders manually specified in `mpv.conf`. If you would like to customize the shader pack,
use `shader_pack_custom`.
- `shader_pack_enable` - Enable shader pack. (Default: `true`)
- `shader_pack_custom` - Enable to use a custom shader pack. (Default: `false`)
- If you enable this, it will copy the default shader pack to the `shader_pack` config folder.
- This initial copy will only happen if the `shader_pack` folder didn't exist.
- This shader pack will then be used instead of the built-in one from then on.
- `shader_pack_remember` - Automatically remember the last used shader profile. (Default: `true`)
- `shader_pack_profile` - The default profile to use. (Default: `null`)
- If you use `shader_pack_remember`, this will be updated when you set a profile through the UI.
- `shader_pack_subtype` - The profile group to use. The default pack contains `lq` and `hq` groups. Use `hq` if you have a fancy graphics card.
### Trickplay Thumbnails
MPV will automatically display thumbnail previews. By default it uses the Jellyfin chapter images
but it can also use JellyScrub as the source. Please note that this feature will download and
uncompress all of the chapter images before it becomes available for a video. For a 4 hour movie this
causes disk usage of about 250 MB, but for the average TV episode it is around 40 MB. It also requires
overriding the default MPV OSC, which may conflict with some custom user script. Trickplay is compatible
with any OSC that uses [thumbfast](https://github.com/po5/thumbfast), as I have added a [compatibility layer](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/jellyfin_mpv_shim/thumbfast.lua).
- `thumbnail_enable` - Enable thumbnail feature. (Default: `true`)
- `thumbnail_jellyscrub` - Use JellyScrub as the thumbnail source instead of chapter images. (Default: `false`)
- `thumbnail_osc_builtin` - Disable this setting if you want to use your own custom osc but leave trickplay enabled. (Default: `true`)
- `thumbnail_preferred_size` - The ideal size for thumbnails. (Default: `320`)
### SVP Integration
To enable SVP integration, set `svp_enable` to `true` and enable "External control via HTTP" within SVP
under Settings > Control options. Adjust the `svp_url` and `svp_socket` settings if needed.
- `svp_enable` - Enable SVP integration. (Default: `false`)
- `svp_url` - URL for SVP web API. (Default: `http://127.0.0.1:9901/`)
- `svp_socket` - Custom MPV socket to use for SVP.
- Default on Windows: `mpvpipe`
- Default on other platforms: `/tmp/mpvsocket`
Currently on Windows the built-in MPV does not work with SVP. You must download MPV yourself.
- Download the latest MPV build [from here](https://sourceforge.net/projects/mpv-player-windows/files/64bit/).
- Follow the [vapoursynth instructions](https://github.com/shinchiro/mpv-winbuild-cmake/wiki/Setup-vapoursynth-for-mpv).
- Make sure to use the latest Python, not Python 3.7.
- In the config file, set `mpv_ext` to `true` and `mpv_ext_path` to the path to `mpv.exe`.
- Make sure to use two backslashes per each backslash in the path.
### SyncPlay
You probably don't need to change these, but they are defined here in case you
need to.
- `sync_max_delay_speed` - Delay in ms before changing video speed to sync playback. Default: `50`
- `sync_max_delay_skip` - Delay in ms before skipping through the video to sync playback. Default: `300`
- `sync_method_thresh` - Delay in ms before switching sync method. Default: `2000`
- `sync_speed_time` - Duration in ms to change playback speed. Default: `1000`
- `sync_speed_attempts` - Number of attempts before speed changes are disabled. Default: `3`
- `sync_attempts` - Number of attempts before disabling sync play. Default: `5`
- `sync_revert_seek` - Attempt to revert seek via MPV OSC. Default: `true`
- This could break if you use revert-seek markers or scripts that use it.
- `sync_osd_message` - Write syncplay status messages to OSD. Default: `true`
### Debugging
These settings assist with debugging. You will often be asked to configure them when reporting an issue.
- `log_decisions` - Log the full media decisions and playback URLs. Default: `false`
- `mpv_log_level` - Log level to use for mpv. Default: `info`
- Options: fatal, error, warn, info, v, debug, trace
- `sanitize_output` - Prevent the writing of server auth tokens to logs. Default: `true`
- `write_logs` - Write logs to the config directory for debugging. Default: `false`
### Other Configuration Options
Other miscellaneous configuration options. You probably won't have to change these.
- `player_name` - The name of the player that appears in the cast menu. Initially set from your hostname.
- `client_uuid` - The identifier for the client. Set to a random value on first run.
- `audio_output` - Currently has no effect. Default: `hdmi`
- `playback_timeout` - Timeout to wait for MPV to start loading video in seconds. Default: `30`
- If you're hitting this, it means files on your server probably got corrupted or deleted.
- It could also happen if you try to play an unsupported video format. These are rare.
- `lang` - Allows overriding system locale. (Enter a language code.) Default: `null`
- MPV Shim should use your OS language by default.
- `ignore_ssl_cert` - Ignore SSL certificates. Default: `false`
- Please consider getting a certificate from Let's Encrypt instead of using this.
- `connect_retry_mins` - Number of minutes to retry connecting before showing login window. Default: `0`
- This only applies for when you first launch the program.
- `lang_filter` - Limit track selection to desired languages. Default: `und,eng,jpn,mis,mul,zxx`
- Note that you need to turn on the options below for this to actually do something.
- If you remove `und` from the list, it will ignore untagged items.
- Languages are typically in [ISO 639-2/B](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),
but if you have strange files this may not be the case.
- `lang_filter_sub` - Apply the language filter to subtitle selection. Default: `False`
- `lang_filter_audio` - Apply the language filter to audio selection. Default: `False`
- `screenshot_dir` - Sets where screenshots go.
- Default is the desktop on Windows and unset (current directory) on other platforms.
- `force_set_played` - This forcibly sets items as played when MPV playback finished.
- If you have files with malformed timestamps that don't get marked as played, enable this.
- `raise_mpv` - Windows only. Disable this if you are fine with MPV sometimes appearing behind other windows when playing.
- `health_check_interval` - The number of seconds between each client health check. Null disables it. Default: `300`
### Skip Intro Support
This functionality is considered experimental and requires the third-party [SkipIntro server plugin](https://github.com/ConfusedPolarBear/intro-skipper). It works the same ways as it did on MPV Shim for Plex.
- `skip_intro_always` - Always skip intros, without asking. Default: `false`
- `skip_intro_prompt` - Prompt to skip intro via seeking. Default: `false`
### MPV Configuration
You can configure mpv directly using the `mpv.conf` and `input.conf` files. (It is in the same folder as `conf.json`.)
This may be useful for customizing video upscaling, keyboard shortcuts, or controlling the application
via the mpv IPC server.
### Authorization
The `cred.json` file contains the authorization information. If you are having problems with the client,
such as the Now Playing not appearing or want to delete a server, you can delete this file and add the
servers again.
## Tips and Tricks
Various tips have been found that allow the media player to support special
functionality, albeit with more configuration required.
### Open on Specific Monitor (#19)
Please note: Edits to the `mpv.conf` will not take effect until you restart the application. You can open the config directory by using the menu option in the system tray icon.
**Option 1**: Select fullscreen output screen through MPV.
Determine which screen you would like MPV to show up on.
- If you are on Windows, right click the desktop and select "Display Settings". Take the monitor number and subtract one.
- If you are on Linux, run `xrandr`. The screen number is the number you want. If there is only one proceed to **Option 2**.
Add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration), replacing `0` with the number from the previous step:
```
fs=yes
fs-screen=0
```
**Option 2**: (Linux Only) If option 1 does not work, both of your monitors are likely configured as a single "screen".
Run `xrandr`. It should look something like this:
```
Screen 0: minimum 8 x 8, current 3520 x 1080, maximum 16384 x 16384
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
1920x1080 60.00*+
1680x1050 59.95
1440x900 59.89
1280x1024 75.02 60.02
1280x960 60.00
1280x800 59.81
1280x720 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
800x600 75.00 72.19 60.32 56.25
640x480 75.00 59.94
LVDS-0 connected 1600x900+1920+180 (normal left inverted right x axis y axis) 309mm x 174mm
1600x900 59.98*+
```
If you want MPV to open on VGA-0 for instance, add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration):
```
fs=yes
geometry=1920x1080+0+0
```
**Option 3**: (Linux Only) If your window manager supports it, you can tell the window manager to always open on a specific screen.
- For OpenBox: https://forums.bunsenlabs.org/viewtopic.php?id=1199
- For i3: https://unix.stackexchange.com/questions/96798/i3wm-start-applications-on-specific-workspaces-when-i3-starts/363848#363848
### Control Volume with Mouse Wheel (#48)
Add the following to `input.conf`:
```
WHEEL_UP add volume 5
WHEEL_DOWN add volume -5
```
### MPRIS Plugin (#54)
Set `mpv_ext` to `true` in the config. Add `script=/path/to/mpris.so` to `mpv.conf`.
### Run Multiple Instances (#45)
You can pass `--config /path/to/folder` to run another copy of the player. Please
note that running multiple copies of the desktop client is currently not supported.
### Audio Passthrough
You can edit `mpv.conf` to support audio passthrough. A [user on Reddit](https://reddit.com/r/jellyfin/comments/fru6xo/new_cross_platform_desktop_client_jellyfin_mpv/fns7vyp) had luck with this config:
```
audio-spdif=ac3,dts,eac3 # (to use the passthrough to receiver over hdmi)
audio-channels=2 # (not sure this is necessary, but i keep it in because it works)
af=scaletempo,lavcac3enc=yes:640:3 # (for aac 5.1 tracks to the receiver)
```
### MPV Crashes with "The sub-scale option must be a floating point number or a ratio"
Run the jellyfin-mpv-shim program with LC_NUMERIC=C.
### Use with gnome-mpv/celluloid (#61)
You can use `gnome-mpv` with MPV Shim, but you must launch `gnome-mpv` separately before MPV Shim. (`gnome-mpv` doesn't support the MPV command options directly.)
Configure MPV Shim with the following options (leave the other ones):
```json
{
"mpv_ext": true,
"mpv_ext_ipc": "/tmp/gmpv-socket",
"mpv_ext_path": null,
"mpv_ext_start": false,
"enable_osc": false
}
```
Then within `gnome-mpv`, click the application icon (top left) > Preferences. Configure the following Extra MPV Options:
```
--idle --input-ipc-server=/tmp/gmpv-socket
```
### Heavy Memory Usage
A problem has been identified where MPV can use a ton of RAM after media has been played,
and this RAM is not always freed when the player goes into idle mode. Some users have
found that using external MPV lessens the memory leak. To enable external MPV on Windows:
- [Download a copy of MPV](https://sourceforge.net/projects/mpv-player-windows/files/64bit/)
- Unzip it with 7zip.
- Configure `mpv_ext` to `true`. (See the config section.)
- Configure `mpv_ext_path` to `C:\\replace\\with\\path\\to\\mpv.exe`. (Note usage of two `\\`.)
- Run the program and wait. (You'll probably have to use it for a while.)
- Let me know if the high memory usage is with `mpv.exe` or the shim itself.
On Linux, the process is similar, except that you don't need to set the `mpv_ext_path` variable.
On macOS, external MPV is already the default and is the only supported player mode.
In the long term, I may look into a method of terminating MPV when not in use. This will require
a lot of changes to the software.
### Player Sizing (#91)
MPV by default may force the window size to match the video aspect ratio, instead of allowing
resizing and centering the video accordingly. Add the following to `mpv.conf` to enable resizing
of the window freely, if desired:
```
no-keepaspect-window
```
## Development
If you'd like to run the application without installing it, run `./run.py`.
The project is written entirely in Python 3. There are no closed-source
components in this project. It is fully hackable.
The project is dependent on `python-mpv`, `python-mpv-jsonipc`, and `jellyfin-apiclient-python`. If you are
using Windows and would like mpv to be maximize properly, `pywin32` is also needed. The GUI
component uses `pystray` and `tkinter`, but there is a fallback cli mode. The mirroring dependencies
are `Jinja2` and `pywebview`, along with platform-specific dependencies. (See the installation and building
guides for details on platform-specific dependencies for display mirroring.)
This project is based Plex MPV Shim, which is based on https://github.com/wnielson/omplex, which
is available under the terms of the MIT License. The project was ported to python3, modified to
use mpv as the player, and updated to allow all features of the remote control api for video playback.
The Jellyfin API client comes from [Jellyfin for Kodi](https://github.com/jellyfin/jellyfin-kodi/tree/master/jellyfin_kodi).
The API client was originally forked for this project and is now a [separate package](https://github.com/iwalton3/jellyfin-apiclient-python).
The css file for desktop mirroring is from [jellyfin-chromecast](https://github.com/jellyfin/jellyfin-chromecast/tree/5194d2b9f0120e0eb8c7a81fe546cb9e92fcca2b) and is subject to GPL v2.0.
The shaders included in the shader pack are also available under verious open source licenses,
[which you can read about here](https://github.com/iwalton3/default-shader-pack/blob/master/LICENSE.md).
### Local Dev Installation
If you are on Windows there are additional dependencies. Please see the Windows Build Instructions.
1. Install the dependencies: `sudo pip3 install --upgrade python-mpv jellyfin-apiclient-python pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- If you run `./gen_pkg.sh --install`, it will also fetch these for you.
2. Clone this repository: `git clone https://github.com/jellyfin/jellyfin-mpv-shim`
- You can also download a zip build.
3. `cd` to the repository: `cd jellyfin-mpv-shim`
4. Run prepare script: `./gen_pkg.sh`
- To do this manually, download the web client, shader pack, and build the language files.
5. Ensure you have a copy of `libmpv1` or `mpv` available.
6. Install any platform-specific dependencies from the respective install tutorials.
7. You should now be able to run the program with `./run.py`. Installation is possible with `sudo pip3 install .`.
- You can also install the package with `./gen_pkg.sh --install`.
### Translation
This project uses gettext for translation. The current template language file is `base.pot` in `jellyfin_mpv_shim/messages/`.
To regenerate `base.pot` and update an existing translation with new strings:
```bash
./regen_pot.sh
```
To compile all `*.po` files to `*.mo`:
```bash
./gen_pkg.sh --skip-build
```
## Linux Installation
You can [install the software from flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim). The pip installation is less integrated but takes up less space if you're not already using flatpak.
If you are on Linux, you can install via pip. You'll need [libmpv1](https://github.com/Kagami/mpv.js/blob/master/README.md#get-libmpv) or `mpv` installed.
```bash
sudo pip3 install --upgrade jellyfin-mpv-shim
```
If you would like the GUI and systray features, also install `pystray` and `tkinter`:
```bash
sudo pip3 install pystray
sudo apt install python3-tk
```
If you would like display mirroring support, install the mirroring dependencies:
```bash
sudo apt install python3-jinja2 python3-webview
# -- OR --
sudo pip3 install jellyfin-mpv-shim[mirror]
sudo apt install gir1.2-webkit2-4.0
```
Discord rich presence support:
```bash
sudo pip3 install jellyfin-mpv-shim[discord]
```
You can build mpv from source to get better codec support. Execute the following:
```bash
sudo pip3 install --upgrade python-mpv
sudo apt install autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake wget python g++ libluajit-5.1-dev
git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
echo --enable-libmpv-shared > mpv_options
./rebuild -j4
sudo ./install
sudo ldconfig
```
## <h2 id="osx-installation">macOS Installation</h2>
Currently on macOS only the external MPV backend seems to be working. I cannot test on macOS, so please report any issues you find.
To install the CLI version:
1. Install brew. ([Instructions](https://brew.sh/))
2. Install python3 and mpv. `brew install python mpv`
3. Install jellyfin-mpv-shim. `pip3 install --upgrade jellyfin-mpv-shim`
4. Run `jellyfin-mpv-shim`.
If you'd like to install the GUI version, you need a working copy of tkinter.
1. Install pyenv. ([Instructions](https://medium.com/python-every-day/python-development-on-macos-with-pyenv-2509c694a808))
2. Install TK and mpv. `brew install tcl-tk mpv`
3. Install python3 with TK support. `FLAGS="-I$(brew --prefix tcl-tk)/include" pyenv install 3.8.1`
4. Set this python3 as the default. `pyenv global 3.8.1`
5. Install jellyfin-mpv-shim and pystray. `pip3 install --upgrade 'jellyfin-mpv-shim[gui]'`
6. Run `jellyfin-mpv-shim`.
Display mirroring is not tested on macOS, but may be installable with 'pip3 install --upgrade 'jellyfin-mpv-shim[mirror]'`.
## Building on Windows
There is a prebuilt version for Windows in the releases section. When
following these directions, please take care to ensure both the python
and libmpv libraries are either 64 or 32 bit. (Don't mismatch them.)
If you'd like to build the installer, please install [Inno Setup](https://jrsoftware.org/isinfo.php) to build
the installer. If you'd like to build a 32 bit version, download the 32 bit version of mpv-1.dll and
copy it into a new folder called mpv32. You'll also need [WebBrowserInterop.x86.dll](https://github.com/r0x0r/pywebview/blob/master/webview/lib/WebBrowserInterop.x86.dll?raw=true).
You may also need to edit the batch file for 32 bit builds to point to the right python executable.
1. Install Git for Windows. Open Git Bash and run `git clone https://github.com/jellyfin/jellyfin-mpv-shim; cd jellyfin-mpv-shim`.
- You can update the project later with `git pull`.
2. Install [Python3](https://www.python.org/downloads/) with PATH enabled. Install [7zip](https://ninite.com/7zip/).
3. After installing python3, open `cmd` as admin and run `pip install --upgrade pyinstaller python-mpv jellyfin-apiclient-python pywin32 pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- Details: https://github.com/pyinstaller/pyinstaller/issues/4346
4. Download [libmpv](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/).
5. Extract the `mpv-2.dll` from the file and move it to the `jellyfin-mpv-shim` folder.
6. Open a regular `cmd` prompt. Navigate to the `jellyfin-mpv-shim` folder.
7. Run `get_pywebview_natives.py`.
8. Run `./gen_pkg.sh --skip-build` using the Git for Windows console.
- This builds the translation files and downloads the shader packs.
9. Run `build-win.bat`.
%package -n python3-jellyfin-mpv-shim
Summary: Cast media from Jellyfin Mobile and Web apps to MPV.
Provides: python-jellyfin-mpv-shim
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-jellyfin-mpv-shim
# Jellyfin MPV Shim
[](https://github.com/jellyfin/jellyfin-mpv-shim/releases)
[](https://pypi.org/project/jellyfin-mpv-shim/)
[](https://translate.jellyfin.org/projects/jellyfin/jellyfin-mpv-shim/)
[](https://github.com/psf/black)
Jellyfin MPV Shim is a cross-platform cast client for Jellyfin.
It has support for all your advanced media files without transcoding, as well as tons of
features which set it apart from other multimedia clients:
- Direct play most media using MPV.
- Watch videos with friends using SyncPlay.
- Offers a shim mode which runs in the background.
- The Jellyfin mobile apps can fully control the client.
- [Reconfigure subtitles](https://github.com/jellyfin/jellyfin-mpv-shim#menu) for an entire season at once.
- Supports all of the [MPV keyboard shortcuts](https://github.com/jellyfin/jellyfin-mpv-shim#keyboard-shortcuts).
- Enhance your video with [Shader Packs](https://github.com/jellyfin/jellyfin-mpv-shim#menu) and [SVP Integration](https://github.com/jellyfin/jellyfin-mpv-shim#svp-integration).
- Optionally share your media activity with friends using Discord Rich Presence.
- Most features, as well as MPV itself, [can be extensively configured](https://github.com/jellyfin/jellyfin-mpv-shim#configuration).
- You can configure the player to use an [external MPV player](https://github.com/jellyfin/jellyfin-mpv-shim#external-mpv) of your choice.
- Enable a chromecast-like experience with [Display Mirroring](https://github.com/jellyfin/jellyfin-mpv-shim#display-mirroring).
- You can [trigger commands to run](https://github.com/jellyfin/jellyfin-mpv-shim#shell-command-triggers) when certain events happen.
To learn more, keep reading. This README explains everything, including [configuration](https://github.com/jellyfin/jellyfin-mpv-shim#configuration), [tips & tricks](https://github.com/jellyfin/jellyfin-mpv-shim#tips-and-tricks), and [development information](https://github.com/jellyfin/jellyfin-mpv-shim#development).
## Getting Started
If you are on Windows, simply [download the binary](https://github.com/jellyfin/jellyfin-mpv-shim/releases).
If you are using Linux, you can [install via flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim) or [install via pip](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#linux-installation). If you are on macOS, see the [macOS Installation](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#osx-installation)
section below.
To use the client, simply launch it and log into your Jellyfin server. You’ll need to enter the
URL to your server, for example `http://server_ip:8096` or `https://secure_domain`. Make sure to
include the subdirectory and port number if applicable. You can then cast your media
from another Jellyfin application.
The application runs with a notification icon by default. You can use this to edit the server settings,
view the application log, open the config folder, and open the application menu. Unlike Plex MPV Shim,
authorization tokens for your server are stored on your device, but you are able to cast to the player
regardless of location.
Note: Due to the huge number of questions and issues that have been submitted about URLs, I now tolerate
bare IP addresses and not specifying the port by default. If you want to connect to port 80 instead of
8096, you must add the `:80` to the URL because `:8096` is now the default.
## Limitations
- Music playback and Live TV are not supported.
- The client can’t be shared seamlessly between multiple users on the same server. ([Link to issue.](https://features.jellyfin.org/posts/319/mark-device-as-shared))
### Known Issues
Please also note that the on-screen controller for MPV (if available) cannot change the
audio and subtitle track configurations for transcoded media. It also cannot load external
subtitles. You must either [use the menu](https://github.com/jellyfin/jellyfin-mpv-shim#menu) or the application you casted from.
Please note the following issues with controlling SyncPlay:
- If you attempt to join a SyncPlay group when casting to MPV Shim, it will play the media but it will not activate SyncPlay.
- You can, however, proceed to activate SyncPlay [using the menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- If you would like to create a group or join a group for currently playing media, [use menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- SyncPlay as of 10.7.0 is new and kind of fragile. You may need to rejoin or even restart the client. Please report any issues you find.
Music playback sort-of works, but repeat, shuffle, and gapless playback have not been implemented and
would require major changes to the application to properly support, as it was built for video.
The shader packs feature is sensitive to graphics hardware. It may simply just not work on your computer.
You may be able to use the log files to get some more diagnostic information. If you're really unlucky,
you'll have to disable the feature by pressing `k` to restore basic functionality.
If you find the solution for your case, *please* send me any information you can provide, as every test case helps.
## Advanced Features
### Menu
To open the menu, press **c** on your computer or use the navigation controls
in the mobile/web app.
The menu enables you to:
- Adjust video transcoding quality.
- Change the default transcoder settings.
- Change subtitles or audio, while knowing the track names.
- Change subtitles or audio for an entire series at once.
- Mark the media as unwatched and quit.
- Enable and disable SyncPlay.
- Configure shader packs and SVP profiles.
- Take screenshots.
On your computer, use the mouse or arrow keys, enter, and escape to navigate.
On your phone, use the arrow buttons, ok, back, and home to navigate.
### Shader Packs
Shader packs are a recent feature addition that allows you to easily use advanced video
shaders and video quality settings. These usually require a lot of configuration to use,
but MPV Shim's default shader pack comes with [FSRCNNX](https://github.com/igv/FSRCNN-TensorFlow)
and [Anime4K](https://github.com/bloc97/Anime4K) preconfigured. Try experimenting with video
profiles! It may greatly improve your experience.
Shader Packs are ready to use as of the most recent MPV Shim version. To use, simply
navigate to the **Video Playback Profiles** option and select a profile.
For details on the shader settings, please see [default-shader-pack](https://github.com/iwalton3/default-shader-pack).
If you would like to customize the shader pack, there are details in the configuration section.
### SVP Integration
SVP integration allows you to easily configure SVP support, change profiles, and enable/disable
SVP without having to exit the player. It is not enabled by default, please see the configuration
instructions for instructions on how to enable it.
### Display Mirroring
This feature allows media previews to show on your display before you cast the media,
similar to Chromecast. It is not enabled by default. To enable it, do one of the following:
- Using the systray icon, click "Application Menu". Go to preferences and enable display mirroring.
- Use the arrow keys, escape, and enter to navigate the menu.
- Cast media to the player and press `c`. Go to preferences and enable display mirroring.
- In the config file (see below), change `display_mirroring` to `true`.
Then restart the application for the change to take effect. To quit the application on Windows with
display mirroring enabled, press Alt+F4.
### Keyboard Shortcuts
This program supports most of the [keyboard shortcuts from MPV](https://mpv.io/manual/stable/#interactive-control). The custom keyboard shortcuts are:
- < > to skip episodes
- q to close player
- w to mark watched and skip
- u to mark unwatched and quit
- c to open the menu
- k disable shader packs
Here are the notable MPV keyboard shortcuts:
- space - Pause/Play
- left/right - Seek by 5 seconds
- up/down - Seek by 1 minute
- s - Take a screenshot
- S - Take a screenshot without subtitles
- f - Toggle fullscreen
- ,/. - Seek by individual frames
- \[/\] - Change video speed by 10%
- {/} - Change video speed by 50%
- backspace - Reset speed
- m - Mute
- d - Enable/disable deinterlace
- Ctrl+Shift+Left/Right - Adjust subtitle delay.
## Configuration
The configuration file is located in different places depending on your platform. You can also open the
configuration folder using the systray icon if you are using the shim version. When you launch the program
on Linux or macOS from the terminal, the location of the config file will be printed. The locations are:
- Windows - `%appdata%\jellyfin-mpv-shim\conf.json`
- Linux - `~/.config/jellyfin-mpv-shim/conf.json`
- Linux (Flatpak) - `~/.var/app/com.github.iwalton3.jellyfin-mpv-shim/config/jellyfin-mpv-shim/conf.json`
- macOS - `~/Library/Application Support/jellyfin-mpv-shim/conf.json`
- CygWin - `~/.config/jellyfin-mpv-shim/conf.json`
You can specify a custom configuration folder with the `--config` option.
### Transcoding
You can adjust the basic transcoder settings via the menu.
- `always_transcode` - This will tell the client to always transcode. Default: `false`
- This may be useful if you are using limited hardware that cannot handle advanced codecs.
- Please note that Jellyfin may still direct play files that meet the transcode profile
requirements. There is nothing I can do on my end to disable this, but you can reduce
the bandwidth setting to force a transcode.
- `transcode_hdr` - Force transcode HDR videos to SDR. Default: `false`
- `transcode_dolby_vision` - Force transcode Dolby Vision videos to SDR. Default: `true`
- If your computer can handle it, you can get tone mapping to work for this using `vo=gpu-next`.
- Note that `vo=gpu-next` is considered experimental by MPV at this time.
- `transcode_hi10p` - Force transcode 10 bit color videos to 8 bit color. Default: `false`
- `remote_kbps` - Bandwidth to permit for remote streaming. Default: `10000`
- `local_kbps` - Bandwidth to permit for local streaming. Default: `2147483`
- `direct_paths` - Play media files directly from the SMB or NFS source. Default: `false`
- `remote_direct_paths` - Apply this even when the server is detected as remote. Default: `false`
- `allow_transcode_to_h265` - Allow the server to transcode media *to* `hevc`. Default: `false`
- If you enable this, it'll allow remuxing to HEVC but it'll also break force transcoding of Dolby Vision and HDR content if those settings are used. (See [this bug](https://github.com/jellyfin/jellyfin/issues/9313).)
- `prefer_transcode_to_h265` - Requests the server to transcode media *to* `hevc` as the default. Default: `false`
- `transcode_warning` - Display a warning the first time media transcodes in a session. Default: `true`
- `force_video_codec` - Force a specified video codec to be played. Default: `null`
- This can be used in tandem with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
- This will override `transcode_to_h265`, `transcode_h265` and `transcode_hi10p`.
- `force_audio_codec` - Force a specified audio codec to be played. Default: `null`
- This can be used in tandeom with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
### Features
You can use the config file to enable and disable features.
- `fullscreen` - Fullscreen the player when starting playback. Default: `true`
- `enable_gui` - Enable the system tray icon and GUI features. Default: `true`
- `enable_osc` - Enable the MPV on-screen controller. Default: `true`
- It may be useful to disable this if you are using an external player that already provides a user interface.
- `media_key_seek` - Use the media next/prev keys to seek instead of skip episodes. Default: `false`
- `use_web_seek` - Use the seek times set in Jellyfin web for arrow key seek. Default: `false`
- `display_mirroring` - Enable webview-based display mirroring (content preview). Default: `false`
- `screenshot_menu` - Allow taking screenshots from menu. Default: `true`
- `check_updates` - Check for updates via GitHub. Default: `true`
- This requests the GitHub releases page and checks for a new version.
- Update checks are performed when playing media, once per day.
- `notify_updates` - Display update notification when playing media. Default: `true`
- Notification will only display once until the application is restarted.
- `discord_presence` - Enable Discord rich presence support. Default: `false`
- `menu_mouse` - Enable mouse support in the menu. Default: `true`
- This requires MPV to be compiled with lua support.
### Shell Command Triggers
You can execute shell commands on media state using the config file:
- `media_ended_cmd` - When all media has played.
- `pre_media_cmd` - Before the player displays. (Will wait for finish.)
- `stop_cmd` - After stopping the player.
- `idle_cmd` - After no activity for `idle_cmd_delay` seconds.
- `idle_when_paused` - Consider the player idle when paused. Default: `false`
- `stop_idle` - Stop the player when idle. (Requires `idle_when_paused`.) Default: `false`
- `play_cmd` - After playback starts.
- `idle_ended_cmd` - After player stops being idle.
### Subtitle Visual Settings
These settings may not works for some subtitle codecs or if subtitles are being burned in
during a transcode. You can configure custom styled subtitle settings through the MPV config file.
- `subtitle_size` - The size of the subtitles, in percent. Default: `100`
- `subtitle_color` - The color of the subtitles, in hex. Default: `#FFFFFFFF`
- `subtitle_position` - The position (top, bottom, middle). Default: `bottom`
### External MPV
The client now supports using an external copy of MPV, including one that is running prior to starting
the client. This may be useful if your distribution only provides MPV as a binary executable (instead
of as a shared library), or to connect to MPV-based GUI players. Please note that SMPlayer exhibits
strange behaviour when controlled in this manner. External MPV is currently the only working backend
for media playback on macOS.
- `mpv_ext` - Enable usage of the external player by default. Default: `false`
- The external player may still be used by default if `libmpv1` is not available.
- `mpv_ext_path` - The path to the `mpv` binary to use. By default it uses the one in the PATH. Default: `null`
- If you are using Windows, make sure to use two backslashes. Example: `C:\\path\\to\\mpv.exe`
- `mpv_ext_ipc` - The path to the socket to control MPV. Default: `null`
- If unset, the socket is a randomly selected temp file.
- On Windows, this is just a name for the socket, not a path like on Linux.
- `mpv_ext_start` - Start a managed copy of MPV with the client. Default: `true`
- If not specified, the user must start MPV prior to launching the client.
- MPV must be launched with `--input-ipc-server=[value of mpv_ext_ipc]`.
- `mpv_ext_no_ovr` - Disable built-in mpv configuration files and use user defaults.
- Please note that some scripts and settings, such as ones to keep MPV open, may break
functionality in MPV Shim.
### Keyboard Shortcuts
You can reconfigure the custom keyboard shortcuts. You can also set them to `null` to disable the shortcut. Please note that disabling keyboard shortcuts may make some features unusable. Additionally, if you remap `q`, using the default shortcut will crash the player.
- `kb_stop` - Stop playback and close MPV. (Default: `q`)
- `kb_prev` - Go to the previous video. (Default: `<`)
- `kb_next` - Go to the next video. (Default: `>`)
- `kb_watched` - Mark the video as watched and skip. (Default: `w`)
- `kb_unwatched` - Mark the video as unwatched and quit. (Default: `u`)
- `kb_menu` - Open the configuration menu. (Default: `c`)
- `kb_menu_esc` - Leave the menu. Exits fullscreen otherwise. (Default: `esc`)
- `kb_menu_ok` - "ok" for menu. (Default: `enter`)
- `kb_menu_left` - "left" for menu. Seeks otherwise. (Default: `left`)
- `kb_menu_right` - "right" for menu. Seeks otherwise. (Default: `right`)
- `kb_menu_up` - "up" for menu. Seeks otherwise. (Default: `up`)
- `kb_menu_down` - "down" for menu. Seeks otherwise. (Default: `down`)
- `kb_pause` - Pause. Also "ok" for menu. (Default: `space`)
- `kb_fullscreen` - Toggle fullscreen. (Default: `f`)
- `kb_debug` - Trigger `pdb` debugger. (Default: `~`)
- `kb_kill_shader` - Disable shader packs. (Default: `k`)
- `seek_up` - Time to seek for "up" key. (Default: `60`)
- `seek_down` - Time to seek for "down" key. (Default: `-60`)
- `seek_right` - Time to seek for "right" key. (Default: `5`)
- `seek_left` - Time to seek for "left" key. (Default: `-5`)
- `media_keys` - Enable binding of MPV to media keys. Default: `true`
- `seek_v_exact` - Use exact seek for up/down keys. Default: `false`
- `seek_h_exact` - Use exact seek for left/right keys. Default: `false`
### Shader Packs
Shader packs allow you to import MPV config and shader presets into MPV Shim and easily switch
between them at runtime through the built-in menu. This enables easy usage and switching of
advanced MPV video playback options, such as video upscaling, while being easy to use.
If you select one of the presets from the shader pack, it will override some MPV configurations
and any shaders manually specified in `mpv.conf`. If you would like to customize the shader pack,
use `shader_pack_custom`.
- `shader_pack_enable` - Enable shader pack. (Default: `true`)
- `shader_pack_custom` - Enable to use a custom shader pack. (Default: `false`)
- If you enable this, it will copy the default shader pack to the `shader_pack` config folder.
- This initial copy will only happen if the `shader_pack` folder didn't exist.
- This shader pack will then be used instead of the built-in one from then on.
- `shader_pack_remember` - Automatically remember the last used shader profile. (Default: `true`)
- `shader_pack_profile` - The default profile to use. (Default: `null`)
- If you use `shader_pack_remember`, this will be updated when you set a profile through the UI.
- `shader_pack_subtype` - The profile group to use. The default pack contains `lq` and `hq` groups. Use `hq` if you have a fancy graphics card.
### Trickplay Thumbnails
MPV will automatically display thumbnail previews. By default it uses the Jellyfin chapter images
but it can also use JellyScrub as the source. Please note that this feature will download and
uncompress all of the chapter images before it becomes available for a video. For a 4 hour movie this
causes disk usage of about 250 MB, but for the average TV episode it is around 40 MB. It also requires
overriding the default MPV OSC, which may conflict with some custom user script. Trickplay is compatible
with any OSC that uses [thumbfast](https://github.com/po5/thumbfast), as I have added a [compatibility layer](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/jellyfin_mpv_shim/thumbfast.lua).
- `thumbnail_enable` - Enable thumbnail feature. (Default: `true`)
- `thumbnail_jellyscrub` - Use JellyScrub as the thumbnail source instead of chapter images. (Default: `false`)
- `thumbnail_osc_builtin` - Disable this setting if you want to use your own custom osc but leave trickplay enabled. (Default: `true`)
- `thumbnail_preferred_size` - The ideal size for thumbnails. (Default: `320`)
### SVP Integration
To enable SVP integration, set `svp_enable` to `true` and enable "External control via HTTP" within SVP
under Settings > Control options. Adjust the `svp_url` and `svp_socket` settings if needed.
- `svp_enable` - Enable SVP integration. (Default: `false`)
- `svp_url` - URL for SVP web API. (Default: `http://127.0.0.1:9901/`)
- `svp_socket` - Custom MPV socket to use for SVP.
- Default on Windows: `mpvpipe`
- Default on other platforms: `/tmp/mpvsocket`
Currently on Windows the built-in MPV does not work with SVP. You must download MPV yourself.
- Download the latest MPV build [from here](https://sourceforge.net/projects/mpv-player-windows/files/64bit/).
- Follow the [vapoursynth instructions](https://github.com/shinchiro/mpv-winbuild-cmake/wiki/Setup-vapoursynth-for-mpv).
- Make sure to use the latest Python, not Python 3.7.
- In the config file, set `mpv_ext` to `true` and `mpv_ext_path` to the path to `mpv.exe`.
- Make sure to use two backslashes per each backslash in the path.
### SyncPlay
You probably don't need to change these, but they are defined here in case you
need to.
- `sync_max_delay_speed` - Delay in ms before changing video speed to sync playback. Default: `50`
- `sync_max_delay_skip` - Delay in ms before skipping through the video to sync playback. Default: `300`
- `sync_method_thresh` - Delay in ms before switching sync method. Default: `2000`
- `sync_speed_time` - Duration in ms to change playback speed. Default: `1000`
- `sync_speed_attempts` - Number of attempts before speed changes are disabled. Default: `3`
- `sync_attempts` - Number of attempts before disabling sync play. Default: `5`
- `sync_revert_seek` - Attempt to revert seek via MPV OSC. Default: `true`
- This could break if you use revert-seek markers or scripts that use it.
- `sync_osd_message` - Write syncplay status messages to OSD. Default: `true`
### Debugging
These settings assist with debugging. You will often be asked to configure them when reporting an issue.
- `log_decisions` - Log the full media decisions and playback URLs. Default: `false`
- `mpv_log_level` - Log level to use for mpv. Default: `info`
- Options: fatal, error, warn, info, v, debug, trace
- `sanitize_output` - Prevent the writing of server auth tokens to logs. Default: `true`
- `write_logs` - Write logs to the config directory for debugging. Default: `false`
### Other Configuration Options
Other miscellaneous configuration options. You probably won't have to change these.
- `player_name` - The name of the player that appears in the cast menu. Initially set from your hostname.
- `client_uuid` - The identifier for the client. Set to a random value on first run.
- `audio_output` - Currently has no effect. Default: `hdmi`
- `playback_timeout` - Timeout to wait for MPV to start loading video in seconds. Default: `30`
- If you're hitting this, it means files on your server probably got corrupted or deleted.
- It could also happen if you try to play an unsupported video format. These are rare.
- `lang` - Allows overriding system locale. (Enter a language code.) Default: `null`
- MPV Shim should use your OS language by default.
- `ignore_ssl_cert` - Ignore SSL certificates. Default: `false`
- Please consider getting a certificate from Let's Encrypt instead of using this.
- `connect_retry_mins` - Number of minutes to retry connecting before showing login window. Default: `0`
- This only applies for when you first launch the program.
- `lang_filter` - Limit track selection to desired languages. Default: `und,eng,jpn,mis,mul,zxx`
- Note that you need to turn on the options below for this to actually do something.
- If you remove `und` from the list, it will ignore untagged items.
- Languages are typically in [ISO 639-2/B](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),
but if you have strange files this may not be the case.
- `lang_filter_sub` - Apply the language filter to subtitle selection. Default: `False`
- `lang_filter_audio` - Apply the language filter to audio selection. Default: `False`
- `screenshot_dir` - Sets where screenshots go.
- Default is the desktop on Windows and unset (current directory) on other platforms.
- `force_set_played` - This forcibly sets items as played when MPV playback finished.
- If you have files with malformed timestamps that don't get marked as played, enable this.
- `raise_mpv` - Windows only. Disable this if you are fine with MPV sometimes appearing behind other windows when playing.
- `health_check_interval` - The number of seconds between each client health check. Null disables it. Default: `300`
### Skip Intro Support
This functionality is considered experimental and requires the third-party [SkipIntro server plugin](https://github.com/ConfusedPolarBear/intro-skipper). It works the same ways as it did on MPV Shim for Plex.
- `skip_intro_always` - Always skip intros, without asking. Default: `false`
- `skip_intro_prompt` - Prompt to skip intro via seeking. Default: `false`
### MPV Configuration
You can configure mpv directly using the `mpv.conf` and `input.conf` files. (It is in the same folder as `conf.json`.)
This may be useful for customizing video upscaling, keyboard shortcuts, or controlling the application
via the mpv IPC server.
### Authorization
The `cred.json` file contains the authorization information. If you are having problems with the client,
such as the Now Playing not appearing or want to delete a server, you can delete this file and add the
servers again.
## Tips and Tricks
Various tips have been found that allow the media player to support special
functionality, albeit with more configuration required.
### Open on Specific Monitor (#19)
Please note: Edits to the `mpv.conf` will not take effect until you restart the application. You can open the config directory by using the menu option in the system tray icon.
**Option 1**: Select fullscreen output screen through MPV.
Determine which screen you would like MPV to show up on.
- If you are on Windows, right click the desktop and select "Display Settings". Take the monitor number and subtract one.
- If you are on Linux, run `xrandr`. The screen number is the number you want. If there is only one proceed to **Option 2**.
Add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration), replacing `0` with the number from the previous step:
```
fs=yes
fs-screen=0
```
**Option 2**: (Linux Only) If option 1 does not work, both of your monitors are likely configured as a single "screen".
Run `xrandr`. It should look something like this:
```
Screen 0: minimum 8 x 8, current 3520 x 1080, maximum 16384 x 16384
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
1920x1080 60.00*+
1680x1050 59.95
1440x900 59.89
1280x1024 75.02 60.02
1280x960 60.00
1280x800 59.81
1280x720 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
800x600 75.00 72.19 60.32 56.25
640x480 75.00 59.94
LVDS-0 connected 1600x900+1920+180 (normal left inverted right x axis y axis) 309mm x 174mm
1600x900 59.98*+
```
If you want MPV to open on VGA-0 for instance, add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration):
```
fs=yes
geometry=1920x1080+0+0
```
**Option 3**: (Linux Only) If your window manager supports it, you can tell the window manager to always open on a specific screen.
- For OpenBox: https://forums.bunsenlabs.org/viewtopic.php?id=1199
- For i3: https://unix.stackexchange.com/questions/96798/i3wm-start-applications-on-specific-workspaces-when-i3-starts/363848#363848
### Control Volume with Mouse Wheel (#48)
Add the following to `input.conf`:
```
WHEEL_UP add volume 5
WHEEL_DOWN add volume -5
```
### MPRIS Plugin (#54)
Set `mpv_ext` to `true` in the config. Add `script=/path/to/mpris.so` to `mpv.conf`.
### Run Multiple Instances (#45)
You can pass `--config /path/to/folder` to run another copy of the player. Please
note that running multiple copies of the desktop client is currently not supported.
### Audio Passthrough
You can edit `mpv.conf` to support audio passthrough. A [user on Reddit](https://reddit.com/r/jellyfin/comments/fru6xo/new_cross_platform_desktop_client_jellyfin_mpv/fns7vyp) had luck with this config:
```
audio-spdif=ac3,dts,eac3 # (to use the passthrough to receiver over hdmi)
audio-channels=2 # (not sure this is necessary, but i keep it in because it works)
af=scaletempo,lavcac3enc=yes:640:3 # (for aac 5.1 tracks to the receiver)
```
### MPV Crashes with "The sub-scale option must be a floating point number or a ratio"
Run the jellyfin-mpv-shim program with LC_NUMERIC=C.
### Use with gnome-mpv/celluloid (#61)
You can use `gnome-mpv` with MPV Shim, but you must launch `gnome-mpv` separately before MPV Shim. (`gnome-mpv` doesn't support the MPV command options directly.)
Configure MPV Shim with the following options (leave the other ones):
```json
{
"mpv_ext": true,
"mpv_ext_ipc": "/tmp/gmpv-socket",
"mpv_ext_path": null,
"mpv_ext_start": false,
"enable_osc": false
}
```
Then within `gnome-mpv`, click the application icon (top left) > Preferences. Configure the following Extra MPV Options:
```
--idle --input-ipc-server=/tmp/gmpv-socket
```
### Heavy Memory Usage
A problem has been identified where MPV can use a ton of RAM after media has been played,
and this RAM is not always freed when the player goes into idle mode. Some users have
found that using external MPV lessens the memory leak. To enable external MPV on Windows:
- [Download a copy of MPV](https://sourceforge.net/projects/mpv-player-windows/files/64bit/)
- Unzip it with 7zip.
- Configure `mpv_ext` to `true`. (See the config section.)
- Configure `mpv_ext_path` to `C:\\replace\\with\\path\\to\\mpv.exe`. (Note usage of two `\\`.)
- Run the program and wait. (You'll probably have to use it for a while.)
- Let me know if the high memory usage is with `mpv.exe` or the shim itself.
On Linux, the process is similar, except that you don't need to set the `mpv_ext_path` variable.
On macOS, external MPV is already the default and is the only supported player mode.
In the long term, I may look into a method of terminating MPV when not in use. This will require
a lot of changes to the software.
### Player Sizing (#91)
MPV by default may force the window size to match the video aspect ratio, instead of allowing
resizing and centering the video accordingly. Add the following to `mpv.conf` to enable resizing
of the window freely, if desired:
```
no-keepaspect-window
```
## Development
If you'd like to run the application without installing it, run `./run.py`.
The project is written entirely in Python 3. There are no closed-source
components in this project. It is fully hackable.
The project is dependent on `python-mpv`, `python-mpv-jsonipc`, and `jellyfin-apiclient-python`. If you are
using Windows and would like mpv to be maximize properly, `pywin32` is also needed. The GUI
component uses `pystray` and `tkinter`, but there is a fallback cli mode. The mirroring dependencies
are `Jinja2` and `pywebview`, along with platform-specific dependencies. (See the installation and building
guides for details on platform-specific dependencies for display mirroring.)
This project is based Plex MPV Shim, which is based on https://github.com/wnielson/omplex, which
is available under the terms of the MIT License. The project was ported to python3, modified to
use mpv as the player, and updated to allow all features of the remote control api for video playback.
The Jellyfin API client comes from [Jellyfin for Kodi](https://github.com/jellyfin/jellyfin-kodi/tree/master/jellyfin_kodi).
The API client was originally forked for this project and is now a [separate package](https://github.com/iwalton3/jellyfin-apiclient-python).
The css file for desktop mirroring is from [jellyfin-chromecast](https://github.com/jellyfin/jellyfin-chromecast/tree/5194d2b9f0120e0eb8c7a81fe546cb9e92fcca2b) and is subject to GPL v2.0.
The shaders included in the shader pack are also available under verious open source licenses,
[which you can read about here](https://github.com/iwalton3/default-shader-pack/blob/master/LICENSE.md).
### Local Dev Installation
If you are on Windows there are additional dependencies. Please see the Windows Build Instructions.
1. Install the dependencies: `sudo pip3 install --upgrade python-mpv jellyfin-apiclient-python pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- If you run `./gen_pkg.sh --install`, it will also fetch these for you.
2. Clone this repository: `git clone https://github.com/jellyfin/jellyfin-mpv-shim`
- You can also download a zip build.
3. `cd` to the repository: `cd jellyfin-mpv-shim`
4. Run prepare script: `./gen_pkg.sh`
- To do this manually, download the web client, shader pack, and build the language files.
5. Ensure you have a copy of `libmpv1` or `mpv` available.
6. Install any platform-specific dependencies from the respective install tutorials.
7. You should now be able to run the program with `./run.py`. Installation is possible with `sudo pip3 install .`.
- You can also install the package with `./gen_pkg.sh --install`.
### Translation
This project uses gettext for translation. The current template language file is `base.pot` in `jellyfin_mpv_shim/messages/`.
To regenerate `base.pot` and update an existing translation with new strings:
```bash
./regen_pot.sh
```
To compile all `*.po` files to `*.mo`:
```bash
./gen_pkg.sh --skip-build
```
## Linux Installation
You can [install the software from flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim). The pip installation is less integrated but takes up less space if you're not already using flatpak.
If you are on Linux, you can install via pip. You'll need [libmpv1](https://github.com/Kagami/mpv.js/blob/master/README.md#get-libmpv) or `mpv` installed.
```bash
sudo pip3 install --upgrade jellyfin-mpv-shim
```
If you would like the GUI and systray features, also install `pystray` and `tkinter`:
```bash
sudo pip3 install pystray
sudo apt install python3-tk
```
If you would like display mirroring support, install the mirroring dependencies:
```bash
sudo apt install python3-jinja2 python3-webview
# -- OR --
sudo pip3 install jellyfin-mpv-shim[mirror]
sudo apt install gir1.2-webkit2-4.0
```
Discord rich presence support:
```bash
sudo pip3 install jellyfin-mpv-shim[discord]
```
You can build mpv from source to get better codec support. Execute the following:
```bash
sudo pip3 install --upgrade python-mpv
sudo apt install autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake wget python g++ libluajit-5.1-dev
git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
echo --enable-libmpv-shared > mpv_options
./rebuild -j4
sudo ./install
sudo ldconfig
```
## <h2 id="osx-installation">macOS Installation</h2>
Currently on macOS only the external MPV backend seems to be working. I cannot test on macOS, so please report any issues you find.
To install the CLI version:
1. Install brew. ([Instructions](https://brew.sh/))
2. Install python3 and mpv. `brew install python mpv`
3. Install jellyfin-mpv-shim. `pip3 install --upgrade jellyfin-mpv-shim`
4. Run `jellyfin-mpv-shim`.
If you'd like to install the GUI version, you need a working copy of tkinter.
1. Install pyenv. ([Instructions](https://medium.com/python-every-day/python-development-on-macos-with-pyenv-2509c694a808))
2. Install TK and mpv. `brew install tcl-tk mpv`
3. Install python3 with TK support. `FLAGS="-I$(brew --prefix tcl-tk)/include" pyenv install 3.8.1`
4. Set this python3 as the default. `pyenv global 3.8.1`
5. Install jellyfin-mpv-shim and pystray. `pip3 install --upgrade 'jellyfin-mpv-shim[gui]'`
6. Run `jellyfin-mpv-shim`.
Display mirroring is not tested on macOS, but may be installable with 'pip3 install --upgrade 'jellyfin-mpv-shim[mirror]'`.
## Building on Windows
There is a prebuilt version for Windows in the releases section. When
following these directions, please take care to ensure both the python
and libmpv libraries are either 64 or 32 bit. (Don't mismatch them.)
If you'd like to build the installer, please install [Inno Setup](https://jrsoftware.org/isinfo.php) to build
the installer. If you'd like to build a 32 bit version, download the 32 bit version of mpv-1.dll and
copy it into a new folder called mpv32. You'll also need [WebBrowserInterop.x86.dll](https://github.com/r0x0r/pywebview/blob/master/webview/lib/WebBrowserInterop.x86.dll?raw=true).
You may also need to edit the batch file for 32 bit builds to point to the right python executable.
1. Install Git for Windows. Open Git Bash and run `git clone https://github.com/jellyfin/jellyfin-mpv-shim; cd jellyfin-mpv-shim`.
- You can update the project later with `git pull`.
2. Install [Python3](https://www.python.org/downloads/) with PATH enabled. Install [7zip](https://ninite.com/7zip/).
3. After installing python3, open `cmd` as admin and run `pip install --upgrade pyinstaller python-mpv jellyfin-apiclient-python pywin32 pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- Details: https://github.com/pyinstaller/pyinstaller/issues/4346
4. Download [libmpv](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/).
5. Extract the `mpv-2.dll` from the file and move it to the `jellyfin-mpv-shim` folder.
6. Open a regular `cmd` prompt. Navigate to the `jellyfin-mpv-shim` folder.
7. Run `get_pywebview_natives.py`.
8. Run `./gen_pkg.sh --skip-build` using the Git for Windows console.
- This builds the translation files and downloads the shader packs.
9. Run `build-win.bat`.
%package help
Summary: Development documents and examples for jellyfin-mpv-shim
Provides: python3-jellyfin-mpv-shim-doc
%description help
# Jellyfin MPV Shim
[](https://github.com/jellyfin/jellyfin-mpv-shim/releases)
[](https://pypi.org/project/jellyfin-mpv-shim/)
[](https://translate.jellyfin.org/projects/jellyfin/jellyfin-mpv-shim/)
[](https://github.com/psf/black)
Jellyfin MPV Shim is a cross-platform cast client for Jellyfin.
It has support for all your advanced media files without transcoding, as well as tons of
features which set it apart from other multimedia clients:
- Direct play most media using MPV.
- Watch videos with friends using SyncPlay.
- Offers a shim mode which runs in the background.
- The Jellyfin mobile apps can fully control the client.
- [Reconfigure subtitles](https://github.com/jellyfin/jellyfin-mpv-shim#menu) for an entire season at once.
- Supports all of the [MPV keyboard shortcuts](https://github.com/jellyfin/jellyfin-mpv-shim#keyboard-shortcuts).
- Enhance your video with [Shader Packs](https://github.com/jellyfin/jellyfin-mpv-shim#menu) and [SVP Integration](https://github.com/jellyfin/jellyfin-mpv-shim#svp-integration).
- Optionally share your media activity with friends using Discord Rich Presence.
- Most features, as well as MPV itself, [can be extensively configured](https://github.com/jellyfin/jellyfin-mpv-shim#configuration).
- You can configure the player to use an [external MPV player](https://github.com/jellyfin/jellyfin-mpv-shim#external-mpv) of your choice.
- Enable a chromecast-like experience with [Display Mirroring](https://github.com/jellyfin/jellyfin-mpv-shim#display-mirroring).
- You can [trigger commands to run](https://github.com/jellyfin/jellyfin-mpv-shim#shell-command-triggers) when certain events happen.
To learn more, keep reading. This README explains everything, including [configuration](https://github.com/jellyfin/jellyfin-mpv-shim#configuration), [tips & tricks](https://github.com/jellyfin/jellyfin-mpv-shim#tips-and-tricks), and [development information](https://github.com/jellyfin/jellyfin-mpv-shim#development).
## Getting Started
If you are on Windows, simply [download the binary](https://github.com/jellyfin/jellyfin-mpv-shim/releases).
If you are using Linux, you can [install via flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim) or [install via pip](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#linux-installation). If you are on macOS, see the [macOS Installation](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/README.md#osx-installation)
section below.
To use the client, simply launch it and log into your Jellyfin server. You’ll need to enter the
URL to your server, for example `http://server_ip:8096` or `https://secure_domain`. Make sure to
include the subdirectory and port number if applicable. You can then cast your media
from another Jellyfin application.
The application runs with a notification icon by default. You can use this to edit the server settings,
view the application log, open the config folder, and open the application menu. Unlike Plex MPV Shim,
authorization tokens for your server are stored on your device, but you are able to cast to the player
regardless of location.
Note: Due to the huge number of questions and issues that have been submitted about URLs, I now tolerate
bare IP addresses and not specifying the port by default. If you want to connect to port 80 instead of
8096, you must add the `:80` to the URL because `:8096` is now the default.
## Limitations
- Music playback and Live TV are not supported.
- The client can’t be shared seamlessly between multiple users on the same server. ([Link to issue.](https://features.jellyfin.org/posts/319/mark-device-as-shared))
### Known Issues
Please also note that the on-screen controller for MPV (if available) cannot change the
audio and subtitle track configurations for transcoded media. It also cannot load external
subtitles. You must either [use the menu](https://github.com/jellyfin/jellyfin-mpv-shim#menu) or the application you casted from.
Please note the following issues with controlling SyncPlay:
- If you attempt to join a SyncPlay group when casting to MPV Shim, it will play the media but it will not activate SyncPlay.
- You can, however, proceed to activate SyncPlay [using the menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- If you would like to create a group or join a group for currently playing media, [use menu within MPV](https://github.com/jellyfin/jellyfin-mpv-shim#menu).
- SyncPlay as of 10.7.0 is new and kind of fragile. You may need to rejoin or even restart the client. Please report any issues you find.
Music playback sort-of works, but repeat, shuffle, and gapless playback have not been implemented and
would require major changes to the application to properly support, as it was built for video.
The shader packs feature is sensitive to graphics hardware. It may simply just not work on your computer.
You may be able to use the log files to get some more diagnostic information. If you're really unlucky,
you'll have to disable the feature by pressing `k` to restore basic functionality.
If you find the solution for your case, *please* send me any information you can provide, as every test case helps.
## Advanced Features
### Menu
To open the menu, press **c** on your computer or use the navigation controls
in the mobile/web app.
The menu enables you to:
- Adjust video transcoding quality.
- Change the default transcoder settings.
- Change subtitles or audio, while knowing the track names.
- Change subtitles or audio for an entire series at once.
- Mark the media as unwatched and quit.
- Enable and disable SyncPlay.
- Configure shader packs and SVP profiles.
- Take screenshots.
On your computer, use the mouse or arrow keys, enter, and escape to navigate.
On your phone, use the arrow buttons, ok, back, and home to navigate.
### Shader Packs
Shader packs are a recent feature addition that allows you to easily use advanced video
shaders and video quality settings. These usually require a lot of configuration to use,
but MPV Shim's default shader pack comes with [FSRCNNX](https://github.com/igv/FSRCNN-TensorFlow)
and [Anime4K](https://github.com/bloc97/Anime4K) preconfigured. Try experimenting with video
profiles! It may greatly improve your experience.
Shader Packs are ready to use as of the most recent MPV Shim version. To use, simply
navigate to the **Video Playback Profiles** option and select a profile.
For details on the shader settings, please see [default-shader-pack](https://github.com/iwalton3/default-shader-pack).
If you would like to customize the shader pack, there are details in the configuration section.
### SVP Integration
SVP integration allows you to easily configure SVP support, change profiles, and enable/disable
SVP without having to exit the player. It is not enabled by default, please see the configuration
instructions for instructions on how to enable it.
### Display Mirroring
This feature allows media previews to show on your display before you cast the media,
similar to Chromecast. It is not enabled by default. To enable it, do one of the following:
- Using the systray icon, click "Application Menu". Go to preferences and enable display mirroring.
- Use the arrow keys, escape, and enter to navigate the menu.
- Cast media to the player and press `c`. Go to preferences and enable display mirroring.
- In the config file (see below), change `display_mirroring` to `true`.
Then restart the application for the change to take effect. To quit the application on Windows with
display mirroring enabled, press Alt+F4.
### Keyboard Shortcuts
This program supports most of the [keyboard shortcuts from MPV](https://mpv.io/manual/stable/#interactive-control). The custom keyboard shortcuts are:
- < > to skip episodes
- q to close player
- w to mark watched and skip
- u to mark unwatched and quit
- c to open the menu
- k disable shader packs
Here are the notable MPV keyboard shortcuts:
- space - Pause/Play
- left/right - Seek by 5 seconds
- up/down - Seek by 1 minute
- s - Take a screenshot
- S - Take a screenshot without subtitles
- f - Toggle fullscreen
- ,/. - Seek by individual frames
- \[/\] - Change video speed by 10%
- {/} - Change video speed by 50%
- backspace - Reset speed
- m - Mute
- d - Enable/disable deinterlace
- Ctrl+Shift+Left/Right - Adjust subtitle delay.
## Configuration
The configuration file is located in different places depending on your platform. You can also open the
configuration folder using the systray icon if you are using the shim version. When you launch the program
on Linux or macOS from the terminal, the location of the config file will be printed. The locations are:
- Windows - `%appdata%\jellyfin-mpv-shim\conf.json`
- Linux - `~/.config/jellyfin-mpv-shim/conf.json`
- Linux (Flatpak) - `~/.var/app/com.github.iwalton3.jellyfin-mpv-shim/config/jellyfin-mpv-shim/conf.json`
- macOS - `~/Library/Application Support/jellyfin-mpv-shim/conf.json`
- CygWin - `~/.config/jellyfin-mpv-shim/conf.json`
You can specify a custom configuration folder with the `--config` option.
### Transcoding
You can adjust the basic transcoder settings via the menu.
- `always_transcode` - This will tell the client to always transcode. Default: `false`
- This may be useful if you are using limited hardware that cannot handle advanced codecs.
- Please note that Jellyfin may still direct play files that meet the transcode profile
requirements. There is nothing I can do on my end to disable this, but you can reduce
the bandwidth setting to force a transcode.
- `transcode_hdr` - Force transcode HDR videos to SDR. Default: `false`
- `transcode_dolby_vision` - Force transcode Dolby Vision videos to SDR. Default: `true`
- If your computer can handle it, you can get tone mapping to work for this using `vo=gpu-next`.
- Note that `vo=gpu-next` is considered experimental by MPV at this time.
- `transcode_hi10p` - Force transcode 10 bit color videos to 8 bit color. Default: `false`
- `remote_kbps` - Bandwidth to permit for remote streaming. Default: `10000`
- `local_kbps` - Bandwidth to permit for local streaming. Default: `2147483`
- `direct_paths` - Play media files directly from the SMB or NFS source. Default: `false`
- `remote_direct_paths` - Apply this even when the server is detected as remote. Default: `false`
- `allow_transcode_to_h265` - Allow the server to transcode media *to* `hevc`. Default: `false`
- If you enable this, it'll allow remuxing to HEVC but it'll also break force transcoding of Dolby Vision and HDR content if those settings are used. (See [this bug](https://github.com/jellyfin/jellyfin/issues/9313).)
- `prefer_transcode_to_h265` - Requests the server to transcode media *to* `hevc` as the default. Default: `false`
- `transcode_warning` - Display a warning the first time media transcodes in a session. Default: `true`
- `force_video_codec` - Force a specified video codec to be played. Default: `null`
- This can be used in tandem with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
- This will override `transcode_to_h265`, `transcode_h265` and `transcode_hi10p`.
- `force_audio_codec` - Force a specified audio codec to be played. Default: `null`
- This can be used in tandeom with `always_transcode` to force the client to transcode into
the specified format.
- This may have the same limitations as `always_transcode`.
### Features
You can use the config file to enable and disable features.
- `fullscreen` - Fullscreen the player when starting playback. Default: `true`
- `enable_gui` - Enable the system tray icon and GUI features. Default: `true`
- `enable_osc` - Enable the MPV on-screen controller. Default: `true`
- It may be useful to disable this if you are using an external player that already provides a user interface.
- `media_key_seek` - Use the media next/prev keys to seek instead of skip episodes. Default: `false`
- `use_web_seek` - Use the seek times set in Jellyfin web for arrow key seek. Default: `false`
- `display_mirroring` - Enable webview-based display mirroring (content preview). Default: `false`
- `screenshot_menu` - Allow taking screenshots from menu. Default: `true`
- `check_updates` - Check for updates via GitHub. Default: `true`
- This requests the GitHub releases page and checks for a new version.
- Update checks are performed when playing media, once per day.
- `notify_updates` - Display update notification when playing media. Default: `true`
- Notification will only display once until the application is restarted.
- `discord_presence` - Enable Discord rich presence support. Default: `false`
- `menu_mouse` - Enable mouse support in the menu. Default: `true`
- This requires MPV to be compiled with lua support.
### Shell Command Triggers
You can execute shell commands on media state using the config file:
- `media_ended_cmd` - When all media has played.
- `pre_media_cmd` - Before the player displays. (Will wait for finish.)
- `stop_cmd` - After stopping the player.
- `idle_cmd` - After no activity for `idle_cmd_delay` seconds.
- `idle_when_paused` - Consider the player idle when paused. Default: `false`
- `stop_idle` - Stop the player when idle. (Requires `idle_when_paused`.) Default: `false`
- `play_cmd` - After playback starts.
- `idle_ended_cmd` - After player stops being idle.
### Subtitle Visual Settings
These settings may not works for some subtitle codecs or if subtitles are being burned in
during a transcode. You can configure custom styled subtitle settings through the MPV config file.
- `subtitle_size` - The size of the subtitles, in percent. Default: `100`
- `subtitle_color` - The color of the subtitles, in hex. Default: `#FFFFFFFF`
- `subtitle_position` - The position (top, bottom, middle). Default: `bottom`
### External MPV
The client now supports using an external copy of MPV, including one that is running prior to starting
the client. This may be useful if your distribution only provides MPV as a binary executable (instead
of as a shared library), or to connect to MPV-based GUI players. Please note that SMPlayer exhibits
strange behaviour when controlled in this manner. External MPV is currently the only working backend
for media playback on macOS.
- `mpv_ext` - Enable usage of the external player by default. Default: `false`
- The external player may still be used by default if `libmpv1` is not available.
- `mpv_ext_path` - The path to the `mpv` binary to use. By default it uses the one in the PATH. Default: `null`
- If you are using Windows, make sure to use two backslashes. Example: `C:\\path\\to\\mpv.exe`
- `mpv_ext_ipc` - The path to the socket to control MPV. Default: `null`
- If unset, the socket is a randomly selected temp file.
- On Windows, this is just a name for the socket, not a path like on Linux.
- `mpv_ext_start` - Start a managed copy of MPV with the client. Default: `true`
- If not specified, the user must start MPV prior to launching the client.
- MPV must be launched with `--input-ipc-server=[value of mpv_ext_ipc]`.
- `mpv_ext_no_ovr` - Disable built-in mpv configuration files and use user defaults.
- Please note that some scripts and settings, such as ones to keep MPV open, may break
functionality in MPV Shim.
### Keyboard Shortcuts
You can reconfigure the custom keyboard shortcuts. You can also set them to `null` to disable the shortcut. Please note that disabling keyboard shortcuts may make some features unusable. Additionally, if you remap `q`, using the default shortcut will crash the player.
- `kb_stop` - Stop playback and close MPV. (Default: `q`)
- `kb_prev` - Go to the previous video. (Default: `<`)
- `kb_next` - Go to the next video. (Default: `>`)
- `kb_watched` - Mark the video as watched and skip. (Default: `w`)
- `kb_unwatched` - Mark the video as unwatched and quit. (Default: `u`)
- `kb_menu` - Open the configuration menu. (Default: `c`)
- `kb_menu_esc` - Leave the menu. Exits fullscreen otherwise. (Default: `esc`)
- `kb_menu_ok` - "ok" for menu. (Default: `enter`)
- `kb_menu_left` - "left" for menu. Seeks otherwise. (Default: `left`)
- `kb_menu_right` - "right" for menu. Seeks otherwise. (Default: `right`)
- `kb_menu_up` - "up" for menu. Seeks otherwise. (Default: `up`)
- `kb_menu_down` - "down" for menu. Seeks otherwise. (Default: `down`)
- `kb_pause` - Pause. Also "ok" for menu. (Default: `space`)
- `kb_fullscreen` - Toggle fullscreen. (Default: `f`)
- `kb_debug` - Trigger `pdb` debugger. (Default: `~`)
- `kb_kill_shader` - Disable shader packs. (Default: `k`)
- `seek_up` - Time to seek for "up" key. (Default: `60`)
- `seek_down` - Time to seek for "down" key. (Default: `-60`)
- `seek_right` - Time to seek for "right" key. (Default: `5`)
- `seek_left` - Time to seek for "left" key. (Default: `-5`)
- `media_keys` - Enable binding of MPV to media keys. Default: `true`
- `seek_v_exact` - Use exact seek for up/down keys. Default: `false`
- `seek_h_exact` - Use exact seek for left/right keys. Default: `false`
### Shader Packs
Shader packs allow you to import MPV config and shader presets into MPV Shim and easily switch
between them at runtime through the built-in menu. This enables easy usage and switching of
advanced MPV video playback options, such as video upscaling, while being easy to use.
If you select one of the presets from the shader pack, it will override some MPV configurations
and any shaders manually specified in `mpv.conf`. If you would like to customize the shader pack,
use `shader_pack_custom`.
- `shader_pack_enable` - Enable shader pack. (Default: `true`)
- `shader_pack_custom` - Enable to use a custom shader pack. (Default: `false`)
- If you enable this, it will copy the default shader pack to the `shader_pack` config folder.
- This initial copy will only happen if the `shader_pack` folder didn't exist.
- This shader pack will then be used instead of the built-in one from then on.
- `shader_pack_remember` - Automatically remember the last used shader profile. (Default: `true`)
- `shader_pack_profile` - The default profile to use. (Default: `null`)
- If you use `shader_pack_remember`, this will be updated when you set a profile through the UI.
- `shader_pack_subtype` - The profile group to use. The default pack contains `lq` and `hq` groups. Use `hq` if you have a fancy graphics card.
### Trickplay Thumbnails
MPV will automatically display thumbnail previews. By default it uses the Jellyfin chapter images
but it can also use JellyScrub as the source. Please note that this feature will download and
uncompress all of the chapter images before it becomes available for a video. For a 4 hour movie this
causes disk usage of about 250 MB, but for the average TV episode it is around 40 MB. It also requires
overriding the default MPV OSC, which may conflict with some custom user script. Trickplay is compatible
with any OSC that uses [thumbfast](https://github.com/po5/thumbfast), as I have added a [compatibility layer](https://github.com/jellyfin/jellyfin-mpv-shim/blob/master/jellyfin_mpv_shim/thumbfast.lua).
- `thumbnail_enable` - Enable thumbnail feature. (Default: `true`)
- `thumbnail_jellyscrub` - Use JellyScrub as the thumbnail source instead of chapter images. (Default: `false`)
- `thumbnail_osc_builtin` - Disable this setting if you want to use your own custom osc but leave trickplay enabled. (Default: `true`)
- `thumbnail_preferred_size` - The ideal size for thumbnails. (Default: `320`)
### SVP Integration
To enable SVP integration, set `svp_enable` to `true` and enable "External control via HTTP" within SVP
under Settings > Control options. Adjust the `svp_url` and `svp_socket` settings if needed.
- `svp_enable` - Enable SVP integration. (Default: `false`)
- `svp_url` - URL for SVP web API. (Default: `http://127.0.0.1:9901/`)
- `svp_socket` - Custom MPV socket to use for SVP.
- Default on Windows: `mpvpipe`
- Default on other platforms: `/tmp/mpvsocket`
Currently on Windows the built-in MPV does not work with SVP. You must download MPV yourself.
- Download the latest MPV build [from here](https://sourceforge.net/projects/mpv-player-windows/files/64bit/).
- Follow the [vapoursynth instructions](https://github.com/shinchiro/mpv-winbuild-cmake/wiki/Setup-vapoursynth-for-mpv).
- Make sure to use the latest Python, not Python 3.7.
- In the config file, set `mpv_ext` to `true` and `mpv_ext_path` to the path to `mpv.exe`.
- Make sure to use two backslashes per each backslash in the path.
### SyncPlay
You probably don't need to change these, but they are defined here in case you
need to.
- `sync_max_delay_speed` - Delay in ms before changing video speed to sync playback. Default: `50`
- `sync_max_delay_skip` - Delay in ms before skipping through the video to sync playback. Default: `300`
- `sync_method_thresh` - Delay in ms before switching sync method. Default: `2000`
- `sync_speed_time` - Duration in ms to change playback speed. Default: `1000`
- `sync_speed_attempts` - Number of attempts before speed changes are disabled. Default: `3`
- `sync_attempts` - Number of attempts before disabling sync play. Default: `5`
- `sync_revert_seek` - Attempt to revert seek via MPV OSC. Default: `true`
- This could break if you use revert-seek markers or scripts that use it.
- `sync_osd_message` - Write syncplay status messages to OSD. Default: `true`
### Debugging
These settings assist with debugging. You will often be asked to configure them when reporting an issue.
- `log_decisions` - Log the full media decisions and playback URLs. Default: `false`
- `mpv_log_level` - Log level to use for mpv. Default: `info`
- Options: fatal, error, warn, info, v, debug, trace
- `sanitize_output` - Prevent the writing of server auth tokens to logs. Default: `true`
- `write_logs` - Write logs to the config directory for debugging. Default: `false`
### Other Configuration Options
Other miscellaneous configuration options. You probably won't have to change these.
- `player_name` - The name of the player that appears in the cast menu. Initially set from your hostname.
- `client_uuid` - The identifier for the client. Set to a random value on first run.
- `audio_output` - Currently has no effect. Default: `hdmi`
- `playback_timeout` - Timeout to wait for MPV to start loading video in seconds. Default: `30`
- If you're hitting this, it means files on your server probably got corrupted or deleted.
- It could also happen if you try to play an unsupported video format. These are rare.
- `lang` - Allows overriding system locale. (Enter a language code.) Default: `null`
- MPV Shim should use your OS language by default.
- `ignore_ssl_cert` - Ignore SSL certificates. Default: `false`
- Please consider getting a certificate from Let's Encrypt instead of using this.
- `connect_retry_mins` - Number of minutes to retry connecting before showing login window. Default: `0`
- This only applies for when you first launch the program.
- `lang_filter` - Limit track selection to desired languages. Default: `und,eng,jpn,mis,mul,zxx`
- Note that you need to turn on the options below for this to actually do something.
- If you remove `und` from the list, it will ignore untagged items.
- Languages are typically in [ISO 639-2/B](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),
but if you have strange files this may not be the case.
- `lang_filter_sub` - Apply the language filter to subtitle selection. Default: `False`
- `lang_filter_audio` - Apply the language filter to audio selection. Default: `False`
- `screenshot_dir` - Sets where screenshots go.
- Default is the desktop on Windows and unset (current directory) on other platforms.
- `force_set_played` - This forcibly sets items as played when MPV playback finished.
- If you have files with malformed timestamps that don't get marked as played, enable this.
- `raise_mpv` - Windows only. Disable this if you are fine with MPV sometimes appearing behind other windows when playing.
- `health_check_interval` - The number of seconds between each client health check. Null disables it. Default: `300`
### Skip Intro Support
This functionality is considered experimental and requires the third-party [SkipIntro server plugin](https://github.com/ConfusedPolarBear/intro-skipper). It works the same ways as it did on MPV Shim for Plex.
- `skip_intro_always` - Always skip intros, without asking. Default: `false`
- `skip_intro_prompt` - Prompt to skip intro via seeking. Default: `false`
### MPV Configuration
You can configure mpv directly using the `mpv.conf` and `input.conf` files. (It is in the same folder as `conf.json`.)
This may be useful for customizing video upscaling, keyboard shortcuts, or controlling the application
via the mpv IPC server.
### Authorization
The `cred.json` file contains the authorization information. If you are having problems with the client,
such as the Now Playing not appearing or want to delete a server, you can delete this file and add the
servers again.
## Tips and Tricks
Various tips have been found that allow the media player to support special
functionality, albeit with more configuration required.
### Open on Specific Monitor (#19)
Please note: Edits to the `mpv.conf` will not take effect until you restart the application. You can open the config directory by using the menu option in the system tray icon.
**Option 1**: Select fullscreen output screen through MPV.
Determine which screen you would like MPV to show up on.
- If you are on Windows, right click the desktop and select "Display Settings". Take the monitor number and subtract one.
- If you are on Linux, run `xrandr`. The screen number is the number you want. If there is only one proceed to **Option 2**.
Add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration), replacing `0` with the number from the previous step:
```
fs=yes
fs-screen=0
```
**Option 2**: (Linux Only) If option 1 does not work, both of your monitors are likely configured as a single "screen".
Run `xrandr`. It should look something like this:
```
Screen 0: minimum 8 x 8, current 3520 x 1080, maximum 16384 x 16384
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
1920x1080 60.00*+
1680x1050 59.95
1440x900 59.89
1280x1024 75.02 60.02
1280x960 60.00
1280x800 59.81
1280x720 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
800x600 75.00 72.19 60.32 56.25
640x480 75.00 59.94
LVDS-0 connected 1600x900+1920+180 (normal left inverted right x axis y axis) 309mm x 174mm
1600x900 59.98*+
```
If you want MPV to open on VGA-0 for instance, add the following to your `mpv.conf` in the [config directory](https://github.com/jellyfin/jellyfin-mpv-shim#mpv-configuration):
```
fs=yes
geometry=1920x1080+0+0
```
**Option 3**: (Linux Only) If your window manager supports it, you can tell the window manager to always open on a specific screen.
- For OpenBox: https://forums.bunsenlabs.org/viewtopic.php?id=1199
- For i3: https://unix.stackexchange.com/questions/96798/i3wm-start-applications-on-specific-workspaces-when-i3-starts/363848#363848
### Control Volume with Mouse Wheel (#48)
Add the following to `input.conf`:
```
WHEEL_UP add volume 5
WHEEL_DOWN add volume -5
```
### MPRIS Plugin (#54)
Set `mpv_ext` to `true` in the config. Add `script=/path/to/mpris.so` to `mpv.conf`.
### Run Multiple Instances (#45)
You can pass `--config /path/to/folder` to run another copy of the player. Please
note that running multiple copies of the desktop client is currently not supported.
### Audio Passthrough
You can edit `mpv.conf` to support audio passthrough. A [user on Reddit](https://reddit.com/r/jellyfin/comments/fru6xo/new_cross_platform_desktop_client_jellyfin_mpv/fns7vyp) had luck with this config:
```
audio-spdif=ac3,dts,eac3 # (to use the passthrough to receiver over hdmi)
audio-channels=2 # (not sure this is necessary, but i keep it in because it works)
af=scaletempo,lavcac3enc=yes:640:3 # (for aac 5.1 tracks to the receiver)
```
### MPV Crashes with "The sub-scale option must be a floating point number or a ratio"
Run the jellyfin-mpv-shim program with LC_NUMERIC=C.
### Use with gnome-mpv/celluloid (#61)
You can use `gnome-mpv` with MPV Shim, but you must launch `gnome-mpv` separately before MPV Shim. (`gnome-mpv` doesn't support the MPV command options directly.)
Configure MPV Shim with the following options (leave the other ones):
```json
{
"mpv_ext": true,
"mpv_ext_ipc": "/tmp/gmpv-socket",
"mpv_ext_path": null,
"mpv_ext_start": false,
"enable_osc": false
}
```
Then within `gnome-mpv`, click the application icon (top left) > Preferences. Configure the following Extra MPV Options:
```
--idle --input-ipc-server=/tmp/gmpv-socket
```
### Heavy Memory Usage
A problem has been identified where MPV can use a ton of RAM after media has been played,
and this RAM is not always freed when the player goes into idle mode. Some users have
found that using external MPV lessens the memory leak. To enable external MPV on Windows:
- [Download a copy of MPV](https://sourceforge.net/projects/mpv-player-windows/files/64bit/)
- Unzip it with 7zip.
- Configure `mpv_ext` to `true`. (See the config section.)
- Configure `mpv_ext_path` to `C:\\replace\\with\\path\\to\\mpv.exe`. (Note usage of two `\\`.)
- Run the program and wait. (You'll probably have to use it for a while.)
- Let me know if the high memory usage is with `mpv.exe` or the shim itself.
On Linux, the process is similar, except that you don't need to set the `mpv_ext_path` variable.
On macOS, external MPV is already the default and is the only supported player mode.
In the long term, I may look into a method of terminating MPV when not in use. This will require
a lot of changes to the software.
### Player Sizing (#91)
MPV by default may force the window size to match the video aspect ratio, instead of allowing
resizing and centering the video accordingly. Add the following to `mpv.conf` to enable resizing
of the window freely, if desired:
```
no-keepaspect-window
```
## Development
If you'd like to run the application without installing it, run `./run.py`.
The project is written entirely in Python 3. There are no closed-source
components in this project. It is fully hackable.
The project is dependent on `python-mpv`, `python-mpv-jsonipc`, and `jellyfin-apiclient-python`. If you are
using Windows and would like mpv to be maximize properly, `pywin32` is also needed. The GUI
component uses `pystray` and `tkinter`, but there is a fallback cli mode. The mirroring dependencies
are `Jinja2` and `pywebview`, along with platform-specific dependencies. (See the installation and building
guides for details on platform-specific dependencies for display mirroring.)
This project is based Plex MPV Shim, which is based on https://github.com/wnielson/omplex, which
is available under the terms of the MIT License. The project was ported to python3, modified to
use mpv as the player, and updated to allow all features of the remote control api for video playback.
The Jellyfin API client comes from [Jellyfin for Kodi](https://github.com/jellyfin/jellyfin-kodi/tree/master/jellyfin_kodi).
The API client was originally forked for this project and is now a [separate package](https://github.com/iwalton3/jellyfin-apiclient-python).
The css file for desktop mirroring is from [jellyfin-chromecast](https://github.com/jellyfin/jellyfin-chromecast/tree/5194d2b9f0120e0eb8c7a81fe546cb9e92fcca2b) and is subject to GPL v2.0.
The shaders included in the shader pack are also available under verious open source licenses,
[which you can read about here](https://github.com/iwalton3/default-shader-pack/blob/master/LICENSE.md).
### Local Dev Installation
If you are on Windows there are additional dependencies. Please see the Windows Build Instructions.
1. Install the dependencies: `sudo pip3 install --upgrade python-mpv jellyfin-apiclient-python pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- If you run `./gen_pkg.sh --install`, it will also fetch these for you.
2. Clone this repository: `git clone https://github.com/jellyfin/jellyfin-mpv-shim`
- You can also download a zip build.
3. `cd` to the repository: `cd jellyfin-mpv-shim`
4. Run prepare script: `./gen_pkg.sh`
- To do this manually, download the web client, shader pack, and build the language files.
5. Ensure you have a copy of `libmpv1` or `mpv` available.
6. Install any platform-specific dependencies from the respective install tutorials.
7. You should now be able to run the program with `./run.py`. Installation is possible with `sudo pip3 install .`.
- You can also install the package with `./gen_pkg.sh --install`.
### Translation
This project uses gettext for translation. The current template language file is `base.pot` in `jellyfin_mpv_shim/messages/`.
To regenerate `base.pot` and update an existing translation with new strings:
```bash
./regen_pot.sh
```
To compile all `*.po` files to `*.mo`:
```bash
./gen_pkg.sh --skip-build
```
## Linux Installation
You can [install the software from flathub](https://flathub.org/apps/details/com.github.iwalton3.jellyfin-mpv-shim). The pip installation is less integrated but takes up less space if you're not already using flatpak.
If you are on Linux, you can install via pip. You'll need [libmpv1](https://github.com/Kagami/mpv.js/blob/master/README.md#get-libmpv) or `mpv` installed.
```bash
sudo pip3 install --upgrade jellyfin-mpv-shim
```
If you would like the GUI and systray features, also install `pystray` and `tkinter`:
```bash
sudo pip3 install pystray
sudo apt install python3-tk
```
If you would like display mirroring support, install the mirroring dependencies:
```bash
sudo apt install python3-jinja2 python3-webview
# -- OR --
sudo pip3 install jellyfin-mpv-shim[mirror]
sudo apt install gir1.2-webkit2-4.0
```
Discord rich presence support:
```bash
sudo pip3 install jellyfin-mpv-shim[discord]
```
You can build mpv from source to get better codec support. Execute the following:
```bash
sudo pip3 install --upgrade python-mpv
sudo apt install autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake wget python g++ libluajit-5.1-dev
git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
echo --enable-libmpv-shared > mpv_options
./rebuild -j4
sudo ./install
sudo ldconfig
```
## <h2 id="osx-installation">macOS Installation</h2>
Currently on macOS only the external MPV backend seems to be working. I cannot test on macOS, so please report any issues you find.
To install the CLI version:
1. Install brew. ([Instructions](https://brew.sh/))
2. Install python3 and mpv. `brew install python mpv`
3. Install jellyfin-mpv-shim. `pip3 install --upgrade jellyfin-mpv-shim`
4. Run `jellyfin-mpv-shim`.
If you'd like to install the GUI version, you need a working copy of tkinter.
1. Install pyenv. ([Instructions](https://medium.com/python-every-day/python-development-on-macos-with-pyenv-2509c694a808))
2. Install TK and mpv. `brew install tcl-tk mpv`
3. Install python3 with TK support. `FLAGS="-I$(brew --prefix tcl-tk)/include" pyenv install 3.8.1`
4. Set this python3 as the default. `pyenv global 3.8.1`
5. Install jellyfin-mpv-shim and pystray. `pip3 install --upgrade 'jellyfin-mpv-shim[gui]'`
6. Run `jellyfin-mpv-shim`.
Display mirroring is not tested on macOS, but may be installable with 'pip3 install --upgrade 'jellyfin-mpv-shim[mirror]'`.
## Building on Windows
There is a prebuilt version for Windows in the releases section. When
following these directions, please take care to ensure both the python
and libmpv libraries are either 64 or 32 bit. (Don't mismatch them.)
If you'd like to build the installer, please install [Inno Setup](https://jrsoftware.org/isinfo.php) to build
the installer. If you'd like to build a 32 bit version, download the 32 bit version of mpv-1.dll and
copy it into a new folder called mpv32. You'll also need [WebBrowserInterop.x86.dll](https://github.com/r0x0r/pywebview/blob/master/webview/lib/WebBrowserInterop.x86.dll?raw=true).
You may also need to edit the batch file for 32 bit builds to point to the right python executable.
1. Install Git for Windows. Open Git Bash and run `git clone https://github.com/jellyfin/jellyfin-mpv-shim; cd jellyfin-mpv-shim`.
- You can update the project later with `git pull`.
2. Install [Python3](https://www.python.org/downloads/) with PATH enabled. Install [7zip](https://ninite.com/7zip/).
3. After installing python3, open `cmd` as admin and run `pip install --upgrade pyinstaller python-mpv jellyfin-apiclient-python pywin32 pystray Jinja2 pywebview python-mpv-jsonipc pypresence`.
- Details: https://github.com/pyinstaller/pyinstaller/issues/4346
4. Download [libmpv](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/).
5. Extract the `mpv-2.dll` from the file and move it to the `jellyfin-mpv-shim` folder.
6. Open a regular `cmd` prompt. Navigate to the `jellyfin-mpv-shim` folder.
7. Run `get_pywebview_natives.py`.
8. Run `./gen_pkg.sh --skip-build` using the Git for Windows console.
- This builds the translation files and downloads the shader packs.
9. Run `build-win.bat`.
%prep
%autosetup -n jellyfin-mpv-shim-2.6.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-jellyfin-mpv-shim -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri Jun 09 2023 Python_Bot <Python_Bot@openeuler.org> - 2.6.0-1
- Package Spec generated
|