dms
dms copied to clipboard
broken pipe from ffmpeg when transcoding
I'm running with -forceTranscodeTo web
and the log is just full of
Sep 09 21:22:11 pride dms[66328]: 2023-09-09T21:22:11+0900 NIL [github.com/anacrolix/dms/dlna/dms.(*Server).serveDLNATranscode:459]: logging transcode to "/home/julius/.dms/log/web/foobar.mkv"
Sep 09 21:22:11 pride dms[66328]: 2023-09-09T21:22:11+0900 NIL [github.com/anacrolix/dms/transcode.transcodePipe:22]: transcode command: [ffmpeg -ss 0:00:00 -i /blub/foobar.mkv -pix_fmt yuv420p -c:v libx264 -crf 25 -c:a mp3 -ab 128k -ar 44100 -preset ultrafast -movflags +faststart+frag_keyframe+empty_moov -f mp4 pipe:]
Sep 09 21:22:11 pride dms[66328]: 2023-09-09T21:22:11+0900 NIL [github.com/anacrolix/dms/transcode.transcodePipe.func1:36]: command [ffmpeg -ss 0:00:00 -i /blub/foobar.mkv -pix_fmt yuv420p -c:v libx264 -crf 25 -c:a mp3 -ab 128k -ar 44100 -preset ultrafast -movflags +faststart+frag_keyframe+empty_moov -f mp4 pipe:] failed: exit status 224
The ffmpeg tail shows
frame= 0 fps=0.0 q=0.0 size= 2kB time=00:00:00.62 bitrate= 26.6kbits/s speed=16.5x ^Mframe= 83 fps=0.0 q=17.0 size= 2kB time=00:00:05.14 bitrate= 3.3kbits/s speed= 9.5x ^Mframe= 184 fps=176 q=20.0 size= 2kB time=00:00:09.48 bitrate= 1.8kbits/s speed=9.07x ^Mav_interleaved_write_frame(): Broken pipe
[out#0/mp4 @ 0x5581efd1ed80] Error muxing a packet
[out#0/mp4 @ 0x5581efd1ed80] Error writing trailer: Broken pipe
frame= 251 fps=171 q=-1.0 Lsize= 2kB time=00:00:12.43 bitrate= 1.3kbits/s speed=8.49x
video:2310kB audio:190kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x5581efe40540] frame I:2 Avg QP:18.50 size: 56818
[libx264 @ 0x5581efe40540] frame P:276 Avg QP:19.63 size: 8692
[libx264 @ 0x5581efe40540] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x5581efe40540] mb P I16..4: 13.7% 0.0% 0.0% P16..4: 24.9% 0.0% 0.0% 0.0% 0.0% skip:61.4%
[libx264 @ 0x5581efe40540] coded y,uvDC,uvAC intra: 4.3% 8.2% 1.3% inter: 3.1% 24.4% 0.4%
[libx264 @ 0x5581efe40540] i16 v,h,dc,p: 93% 4% 2% 1%
[libx264 @ 0x5581efe40540] i8c dc,h,v,p: 83% 8% 9% 1%
[libx264 @ 0x5581efe40540] kb/s:1735.42
Conversion failed!
5f203178540] i8c dc,h,v,p: 83% 8% 9% 1%
[libx264 @ 0x55f203178540] kb/s:1735.42
Conversion failed!
This would indicate to me that dms isn't reading the data - how would I debug this?
[Edit:] This seems to only happen when trying to play files from my Panasonic TV. Hmm.
This error should occur when the device you're streaming abruptly rejects the stream. Most likely the format that ffmpeg is sending is not what the TV is expecting, or is not supported by the TV. Perhaps web
is the wrong transcode target for your TV.
That was my first hypothesis, but I finally got some time to look around:
- The error is output once per second many times over, seemingly indefinitely, while the TV displays a spinner.
- This behavior only happens with
webb
andchromecast
. Withvp8
, the TV immediately displays a "Unplayable file" message - I confirmed that I can stream files with dms (without
-forceTranscode
) that can also be streamed from other servers (minidlna/rygel) - I created a
foo.dms.json
containing{"Title":"Foo","Resources":[{"MimeType":"video/x-matroska","Command":"cat file-that-plays-without-transcoding.mkv"}]}
and confirmed that it doesn't play (I get the samefailed: signal: broken pipe
but no spinner from the TV, just an immediate exit from the playback menu. - Looking at
-logHeaders
, it seems there are two subsequent requests, the second containingRange: bytes=7075-
.
Could the range request pose a problem? [Edit:] Looking at the response, there's no Content-Range
, so I'll make that my prime suspect.
Hm yes, I don't remember the specifics (I started this project nearly 12 years ago), but I doubt range requests are supported for on-the-fly transcodes if that is what it is doing. Range requests should work fine for static files.