'Streaming' MP4 files

I see that FFMPEG working for 'streaming' in Moc, but when you put in an mp4, it doesn't work.

If MP4 can be supported in streaming, I could make a patch to support youtube videos, which I'm sure a lot of people would enjoy :)

Forums:

Actually, upon further looking, this is actually a bug..

I've looked through the source, and I can't find why it doesn't play mp4 files.

I don't know where you saw that, but it isn't so. However, there is someone who has undertaken to do that work already.

I suspect what you actually mean is that MOC can play the audio from videos using FFmpeg/LibAV, and that is indeed true. But it needs the specific codecs to be turned on individually and for that to happen I have determine how badly broken FFmpeg/LibAV is for that particular codec.

Well,

For example, I can play a local mp4 file fine, and it plays the audio from the video. But if you "open a link" to the same mp4 file, it won't play it because it isn't a "Format not supported". Perhaps because the 'grabbing of audio' from the MP4 file isn't in the 'download' section?

Edit: So, for example(x2), If we go into mocp and press 'o', and then enter http://nes-wiki.org/docs/QWU6tVxzO1I.mp4, it will say "Format not supported".

But then if we close mocp and run this:
ffplay -i 'http://nes-wiki.org//docs/QWU6tVxzO1I.mp4' , it will play fine.(Actually, it's extremely laggy, but that's not ffplay's fault)

My _guess_ is that it's something that isn't included in the patch here: http://moc.daper.net/node/913
But audio is NOT my thing, so I can't even comment..
I'm also not sure of how mocp handles mp4's, but it could also be that.

The reason I think it's a bug, is because..
Dec 1 20:26:11.134852: io_curl.c:106 header_callback(): Mime type: 'video/mp4'

Dec 1 20:26:11.489499: server.c:775 server_error(): ERROR: Format not supported

So it knows that it's a video/mp4, but for some reason is doesn't play.

Firstly, the FFmpeg/LibAV decoder currently supplied with MOC doesn't support streams, so when MOC tried to find a decoder for video/mp4 it would not have considered the FFmpeg/LibAV decoder (which is the only one which might have done so).

The ffmpeg_nopause patch was the one I referred to above but I haven't have time to consider it in detail as yet. There was nothing in your original post which would have lead me to believe you were using that patch.

I will alert that patch's author to your predicament.

I've just tried re-installing from a fresh repo mocp, and I can still play MP3 files.(From opening an .mp3 link)

--
Ugh, I'm stupid.

So, when I was testing, I thought you had already added that patch to the main code, so I never actually tested installing that patch.
So I assumed it was a problem with that code[which had been accepted].

Now, when patching, and opening an mp4, I get this:
"Error in the stream!"

Debug info:(server):
mocp_server_log-12491-Dec 2 03:02:25.687982: io_curl.c:61 write_callback(): Got 1528 bytes
mocp_server_log-12492-Dec 2 03:02:25.687987: io_curl.c:594 io_curl_read(): Read 558 bytes from the buffer (8096 bytes full)
mocp_server_log-12493-Dec 2 03:02:25.687994: server.c:257 wake_up_server(): Waking up the server
mocp_server_log-12494-Dec 2 03:02:25.688000: server.c:1723 server_loop(): Got 'wake up'
mocp_server_log-12495-Dec 2 03:02:25.688004: server.c:645 send_events(): Flushing events for client 0
mocp_server_log-12496-Dec 2 03:02:25.688076: io.c:586 io_prebuffer(): done
mocp_server_log-12497-Dec 2 03:02:25.688081: server.c:257 wake_up_server(): Waking up the server
mocp_server_log-12498-Dec 2 03:02:25.688086: server.c:1723 server_loop(): Got 'wake up'
mocp_server_log-12499-Dec 2 03:02:25.688091: server.c:645 send_events(): Flushing events for client 0
mocp_server_log-12500-Dec 2 03:02:25.688165: ffmpeg.c:234 ffmpeg_log_repeats(): FFmpeg said: stream 0, offset 0x1f6e0: partial file
mocp_server_log:12501:Dec 2 03:02:25.688173: server.c:775 server_error(): ERROR: Error in the stream!

Dec 2 03:00:34.607330: io_curl.c:594 io_curl_read(): Read 2026 bytes from the buffer (2026 bytes full)
Dec 2 03:00:34.607335: io_curl.c:350 curl_read_internal(): Doing select()...
Dec 2 03:00:34.608382: ffmpeg.c:234 ffmpeg_log_repeats(): FFmpeg said: stream 0, offset 0x1f534: partial file
Dec 2 03:00:34.608403: ffmpeg.c:234 ffmpeg_log_repeats(): FFmpeg said: Could not find codec parameters (Video: h264, 1920x1080, 3845 kb/s)
Dec 2 03:00:34.608512: ffmpeg.c:1093 ffmpeg_open_stream(): FFmpeg thinks '(stream)' is format(codec) 'mov,mp4,m4a,3gp,3g2,mj2(aac)'
Dec 2 03:00:34.610079: server.c:1182 req_get_tags(): Sending tags to client with fd 3...
Dec 2 03:00:34.610151: player.c:468 decode_loop(): No get_stream() function
Dec 2 03:00:34.610160: server.c:257 wake_up_server(): Waking up the server
Dec 2 03:00:34.610165: player.c:473 decode_loop(): loop...
Dec 2 03:00:34.610170: io.c:575 io_prebuffer(): prebuffering to 6

I can't see anything else important in the logs, but I may be wrong.

I have now committed the parts of the "ffmpeg_nopause patch" which implement the playing of Internet audio streams via the FFmpeg decoder. I tried to play the URL referenced in your post but the site seems to have gone off the air, so are you able to try with another MP4 video file and with MOC built from the current SVN HEAD to see if it's still a problem?

It may have something to do with the MIME type being 'video/...' and not 'audio/...', and if that's so it may be internal to the FFmpeg libraries.