Posted: . At: 11:56 AM. This was 3 years ago. Post ID: 14807
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


An example of recording TV with MPV on Linux.


This is a sample command, I used this to record TV with MPV from a stream. This is quite problematic, but I managed to get this working on the example stream.

┌──[jason@192.168.1.2][~]
└──╼  ╼ $ mpv https://c.mjh.nz/101002210221/ --stream-record=tv1.ts --demuxer-lavf-probe-info=yes
[ffmpeg] hls demuxer: Can't support the subtitle(uri: hdntl=exp=1607128378~acl=%2f*~data=hdntl~hmac=a731c5d7a64c0589edb0290b2e2f44e9c48f2dbb1cf2f564d3d0914ee3341922/index_7_0.m3u8)
     Video --vid=1 'bitrate 1910576' (h264 1024x576 25.000fps)
     Video --vid=2 'bitrate 994210' (h264 640x360 25.000fps)
     Video --vid=3 'bitrate 737242' (h264 512x288 25.000fps)
 (+) Video --vid=4 'bitrate 4806388' (h264 1280x720 25.000fps)
     Audio --aid=1 'bitrate 1910576' (aac 2ch 48000Hz)
     Audio --aid=2 'bitrate 994210' (aac 2ch 48000Hz)
     Audio --aid=3 'bitrate 737242' (aac 2ch 48000Hz)
 (+) Audio --aid=4 'bitrate 4806388' (aac 2ch 48000Hz)
[recorder] This is an experimental feature. Output files might be broken or not play correctly with various players (including mpv itself).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:01:34 / 00:01:47 (87%) A-V:  0.000 Cache: 13s/7MB
 
 
Exiting... (Quit)

This is the command used to record a stream.

mpv https://c.mjh.nz/101002210221/ --stream-record=tv1.ts --demuxer-lavf-probe-info=yes

The recording format must exactly match the input format, so this is the hard part: determining the input format to enable this to work. You cannot seek while using –stream-record record to a file, but this is one way to record an important stream with MPV. I wish there was an easier way, I guess transcoding whilst recording would be more intensive on the CPU. But this does allow the user to watch the stream whilst recording. That is very useful.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.