Page 1 of 1

new s4c plugin works but TV says "unsupported file format"

PostPosted: Thu Nov 03, 2011 12:18 am
by owennewo
I've spent a few hours writing a plugin for S4C (
S4c.groovy
(3.67 KiB) Downloaded 840 times
) - a welsh language channel that has an iplayer-like web interface.

The plugin seems to work (I can browse to it and see the list of rss items on the tv), however my samsung c- series (750) says that it doesn't like the file format when I play an item.

runnimg ffmpeg on the stream reveals that the stream is h264 (High), yuv420p, 528x304 with Audio: aac, 44100 Hz, stereo, s16.

Any reason why this is not supported on C-Series? I've recently upgraded from 0.51 to 0.6.0.1 - do I need to configure some transcoding?

ffmpeg -i rtmp://multistrm.fcod.llnwd.net/a2278/o ... e24771.mp4
ffmpeg version 0.8.5.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 1 2011 23:43:42 with gcc 4.4.5
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 22. 0 / 51. 22. 0
libavcodec 53. 26. 0 / 53. 26. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, flv, from 'rtmp://multistrm.fcod.llnwd.net/a2278/o21/s4c/uk/BSM/fferm_ffactor__pennod_4_cymraeg_dv50sd001de24771.mp4':
Metadata:
moovPosition : 124521682
avcprofile : 100
avclevel : 21
aacaot : 2
videoframerate : 25
audiochannels : 2
Duration: 00:23:58.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 528x304 [SAR 217:212 DAR 7161:4028], 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, s16

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Thu Nov 03, 2011 10:40 am
by zip
most likely it's because your FFmpeg is not linked with libRTMP (missing --enable-librtmp in the ffmpeg configure header)

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Thu Nov 03, 2011 11:56 am
by jhb50
I can't try it because I'm not in UK, and get a file unavailable message.
I believe your C series can play the file natively but the SAR and DAR looks strange to me. Try transcoding all .mkvs and see what happens.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Thu Nov 03, 2011 11:57 pm
by owennewo
My ffmpeg has librmtp support. I've compile libx264 and ffmpeg from source with the librmtp flag.

I think I know what's going on.... but need a bit of help

I can manually download the stream using:
ffmpeg -i rtmp://multistrm.fcod.llnwd.net/a2278/o ... ad783b.mp4 -codec copy sample_s4c.mp4

If I manually copy this file into the rest of my films (waiting a few mins for Serviio to scan it) I can watch the programme using my Samsung C 750. So why does is it fail with streaming?

I'm seeing the following in the logs...

ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: Transcoded file '/tmp/Serviio/transcoding-temp-1000000000040002-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
java.io.IOException: Transcoded file '/tmp/Serviio/transcoding-temp-1000000000040002-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
at org.serviio.delivery.resource.AbstractTranscodingDeliveryEngine.retrieveTranscodedResource(AbstractTranscodingDeliveryEngine.java:115)

Why is serviio trying to transcode this file to mpeg2 for online streams but not for local files? Any help with config would be appreciated.

Owen

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 12:17 am
by zip
it needs to be transcoded as mp4 file includes some data at the end of the file and that is not convenient to read those bytes from online stream (slow, some web servers don't support byte range GET)... so it's just rewrapping the file.

What happens if you run the ffmpeg command manually? It should fail, post the result.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 9:51 pm
by jhb50
The stock Samsung C/D profile inherited online .mp4 generic profile transcoding is intercepted by Samsung B profile which transcodes to mpeg2video and will not play due to Bug #435 but the proper fix for online is to correct the Samsung C/D profile as per Bug #432. It should then play fine.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 10:13 pm
by owennewo
I've quickly scanned that bug, I've some more info that might suggest that this is something else. Although I may hit your bug later.

I turned logging to debug in order to get the command that ffmpeg is using and ran the same command manually:

ffmpeg -i rtmp://multistrm.fcod.llnwd.net/a2278/o ... eecbcc.mp4 buffer=100000000 -y -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec ac3 -ab 384k -ac 2 -sn -f mpegts /tmp/Serviio/transcoding-temp-1000000000040007-MPEG2TS.stf
ffmpeg version 0.8.5.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 1 2011 23:43:42 with gcc 4.4.5
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 22. 0 / 51. 22. 0
libavcodec 53. 26. 0 / 53. 26. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, flv, from 'rtmp://multistrm.fcod.llnwd.net/a2278/o21/s4c/uk/BSM/123__pennod_3_cymraeg_dv50sd0014eecbcc.mp4':
Metadata:
moovPosition : 65873372
avcprofile : 100
avclevel : 21
aacaot : 2
videoframerate : 25
audiochannels : 2
Duration: 00:12:39.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 528x304 [SAR 217:212 DAR 7161:4028], 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, s16
[NULL @ 0x281c3c0] Unable to find a suitable output format for 'buffer=100000000'
buffer=100000000: Invalid argument

If I remove "buffer=100000000" from the command ffmpeg starts to work. Just need to workout where 'buffer=100000000' is coming from now!!

I've also tried quoting url with buffer, e.g. as this is done on another forum thread (viewtopic.php?f=21&t=3613):

ffmpeg -i "rtmp://multistrm.fcod.llnwd.net/a2278/o21/s4c/uk/BSM/123__pennod_3_cymraeg_dv50sd0014eecbcc.mp4 buffer=100000000" -y -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec ac3 -ab 384k -ac 2 -sn -f mpegts /tmp/Serviio/transcoding-temp-1000000000040007-MPEG2TS.stf

ffmpeg didn't fall over it just hung after showing:

ffmpeg version 0.8.5.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 1 2011 23:43:42 with gcc 4.4.5
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 22. 0 / 51. 22. 0
libavcodec 53. 26. 0 / 53. 26. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0



Owen

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 10:38 pm
by jhb50
You said you were transcoding to mpeg2video but this is an mp4 remux with just audio conversion so its not the original ffmpeg transcode that you reported did not play. Did you use my new C/D profile?

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 10:47 pm
by owennewo
Apologies.

The error I saw in logs was this:
Transcoded file '/tmp/Serviio/transcoding-temp-1000000000040002-MPEG2TS.stf' cannot be found

I thought this meant that it had been encoded to MPEG2. When I turned logs to debug I could see what ffmpeg was really doing. Sorry for giving confusing info.

Any idea why "buffer=100000000" is there?

Owen

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 11:01 pm
by zip
so that it downloads the file faster

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 04, 2011 11:24 pm
by jhb50
If you are using the stock Samsung C/D profile it would be transcoding to mpeg2video as I explained....so what are you using?

Also when attachin ffmpeg output include it all.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Sat Nov 05, 2011 11:40 pm
by owennewo
I've changed the online profile to that described here: https://bitbucket.org/xnejp03/serviio/i ... ranscoding

No difference.

Below are two ffmpeg commands - the first is the one serviio uses (it doesn't work), the second one works (I've removed the buffer=100000000)

1) serviio (doesn't work)
ffmpeg -i rtmp://multistrm.fcod.llnwd.net/a2278/o ... cbdcf5.mp4 buffer=100000000 -y -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec ac3 -ab 192k -ac 2 -sn -f mpegts /tmp/Serviio/transcoding-temp-1000000000040004-MPEG2TS.stf

ffmpeg version 0.8.5.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 1 2011 23:43:42 with gcc 4.4.5
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 22. 0 / 51. 22. 0
libavcodec 53. 26. 0 / 53. 26. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, flv, from 'rtmp://multistrm.fcod.llnwd.net/a2278/o21/s4c/uk/BSM/byw_yn_ol_y_papur_newydd__pennod_2_cymr001dcbdcf5.mp4':
Metadata:
moovPosition : 121385929
avcprofile : 100
avclevel : 21
aacaot : 2
videoframerate : 25
audiochannels : 2
Duration: 00:23:37.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 528x304 [SAR 217:212 DAR 7161:4028], 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, s16
[NULL @ 0x2a4bda0] Unable to find a suitable output format for 'buffer=100000000'
buffer=100000000: Invalid argument

2) modified serviio (works)

ffmpeg -i rtmp://multistrm.fcod.llnwd.net/a2278/o ... cbdcf5.mp4 -y -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec ac3 -ab 192k -ac 2 -sn -f mpegts /tmp/Serviio/transcoding-temp-1000000000040004-MPEG2TS.stf

ffmpeg version 0.8.5.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 1 2011 23:43:42 with gcc 4.4.5
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
libavutil 51. 22. 0 / 51. 22. 0
libavcodec 53. 26. 0 / 53. 26. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, flv, from 'rtmp://multistrm.fcod.llnwd.net/a2278/o21/s4c/uk/BSM/byw_yn_ol_y_papur_newydd__pennod_2_cymr001dcbdcf5.mp4':
Metadata:
moovPosition : 121385929
avcprofile : 100
avclevel : 21
aacaot : 2
videoframerate : 25
audiochannels : 2
Duration: 00:23:37.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 528x304 [SAR 217:212 DAR 7161:4028], 25 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, s16
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 0x2c98d20] channel_layout not specified
[ac3 @ 0x2c98d20] No channel layout specified. The encoder will guess the layout, but it might be incorrect.
[mpegts @ 0x2ccada0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/tmp/Serviio/transcoding-temp-1000000000040004-MPEG2TS.stf':
Metadata:
moovPosition : 121385929
avcprofile : 100
avclevel : 21
aacaot : 2
videoframerate : 25
audiochannels : 2
encoder : Lavf53.18.0
Stream #0:0: Video: h264, yuv420p, 528x304 [SAR 217:212 DAR 7161:4028], q=2-31, 90k tbn, 25 tbc
Stream #0:1: Audio: ac3, 44100 Hz, stereo, flt, 192 kb/s
Stream mapping:
Stream #0.0 -> #0.0 (copy)
Stream #0.1 -> #0.1 (aac -> ac3)
Press [q] to stop, [?] for help
frame= 1343 fps= 26 q=-1.0 Lsize= 6734kB time=00:00:53.72 bitrate=1026.9kbits/s

I believe ffmpeg is treating the buffer=10000000 as an argument - I'm struggling to find any man pages where this is a valid argument.....

Owen

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Sun Nov 06, 2011 12:58 am
by zip
That is a librtmp parameter and has to be wrapped together with the url (and possible other parameters) in double quotes. They are not in the log but Serviio uses them.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Sun Nov 06, 2011 3:24 am
by jhb50
Zip, so how does he know what ffmpeg command to use to replicate the Sereviio transcoding?

Owen.. the original profile transcoded to mpeg2video and the new one just copies the video.

Restore the original C/D profile and still using the C/D profile add the maxVBitrate to the On-line transcoding command in the Samsung B profile which will be picked up by the C/D profile and see if it will play that way.

Re: new s4c plugin works but TV says "unsupported file forma

PostPosted: Fri Nov 11, 2011 12:19 am
by owennewo
[cough] ....ummmm it turns out I didn't have librtmp support enabled. [cough embarrassed]

Next time zip says have you got librtmp support enabled, listen to him.

ffmpeg comes with poor rtmp support enough to do some basic stuff but it can't handle rtmp parameters like "buffer="

A good way to find out if it is enabled is to run "ffmpeg -protocols" and look for support for rtmpe, rtmpt, rtmpte, rtmps. By default ffmpeg (without librtmp) supports rtmp only.

I've tested my plugin on totem - that works, just need to get my wife off the Samsung to test it on the telly. ;)