Strange error when attempting to build MediaObject

Hey guys, me again.

 

I've been attempting to clean up my plugin and one of the items on the list was to narrow down the available media sources and present proper MediaObjects so that clients that can Direct Play will do so, rather than transcode everything.

 

Here is my MediaObject:

 

return[MediaObject(
	video_resolution = int(quality),
	container = Container.MP4,
	video_codec = VideoCodec.H264,
	video_frame_rate = 24,
	audio_channels = 2,
	audio_codec = AudioCodec.AAC,
	optimized_for_streaming = True,
	parts = [PartObject(key=Callback(PlayVideo, url = link, quality = quality))]
	)
]

 

... and this plays fine in PMC.  However, when attempting to play on Android or ATV (via PlexConnect), I get an error telling me the client cannot play this video.  However, if I remove the line "audio_channels = 2," the video will play fine (direct), but the audio transcodes on the fly.  Being that the video source is definatly stereo AAC, I can't for the life of me figure out why they wont play on my other clients?!  The PMS logs show that I seem to be killing the transcoder:

 

Sep 10, 2013 00:15:12 [0xaaf67b70] ERROR - [Transcoder] Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec cop
Sep 10, 2013 00:15:12 [0xa82ffb70] ERROR - [Transcoder] : Invalid argument
Sep 10, 2013 00:15:12 [0xac2efb70] DEBUG - Request: GET /video/:/transcode/universal/session/1d4152aa-6d50-456e-aaf2-7f02adbc9598/base/00000.ts [192.168.1.151:45666] (5 live)
Sep 10, 2013 00:15:12 [0xac2efb70] DEBUG - Asked for segment 0 from session.
Sep 10, 2013 00:15:14 [0xaaf67b70] ERROR - [Transcoder] [mpegts @ 0x92530a0] AAC bitstream not in ADTS format and extradata missing
Sep 10, 2013 00:15:14 [0xa82ffb70] ERROR - [Transcoder] av_interleaved_write_frame(): Invalid data found when processing input
Sep 10, 2013 00:15:14 [0xac2efb70] DEBUG - Returning segment 0 from session: /mnt/cache/apps/Plex/Temp/plex-transcode-1d4152aa-6d50-456e-aaf2-7f02adbc9598-c5326dd3-5e2d-47e9-91cc-be955c0b48f3/media-00000.ts
Sep 10, 2013 00:15:14 [0xac2efb70] DEBUG - Content-Length of /mnt/cache/apps/Plex/Temp/plex-transcode-1d4152aa-6d50-456e-aaf2-7f02adbc9598-c5326dd3-5e2d-47e9-91cc-be955c0b48f3/media-00000.ts is 857656.
Sep 10, 2013 00:15:14 [0xaaf67b70] DEBUG - Request: GET /video/:/transcode/universal/session/1d4152aa-6d50-456e-aaf2-7f02adbc9598/base/00001.ts [192.168.1.151:45667] (5 live)
Sep 10, 2013 00:15:14 [0xaaf67b70] DEBUG - Asked for segment 1 from session.
Sep 10, 2013 00:15:14 [0xaaf67b70] WARN - Transcode runner appears to have died.
Sep 10, 2013 00:15:14 [0xaaf67b70] WARN - Timed out waiting for segment.

 

Am I doing something wrong?  Thanks in advance.

 

Jamie

Seems like there may be something funky with that file that the transcoder can't handle. can you post a sample or a link to the file so we can get try to reproduce the issue?

Thanks for the quick reply.  The file is hosted here:

http://redirector.googlevideo.com/videoplayback?id=5035c1b771517416&itag=18&source=picasa&cmo=sensitive_content=yes&ip=0.0.0.0&ipbits=0&expire=1381358483&sparams=id,itag,source,ip,ipbits,expire&signature=81D8E982CE93AD0E35AFC4384C152C6F7FB31F97.5DD86F12E0DB12E51CAE1C260A905BB52D72A86D&key=lh1

Keep in mind, if I leave out enough options or disable direct play on the android client, it will transcode and play fine.  It's only when trying to get the file to direct play.  However it works regardless on PMC.

EDIT:  Further to this, it also works fine when using the external player option and MX Player on Android.  Obviously a workaround but not ideal.

So basically, if you provide enough detail for the Android client to decide whether to direct play rather than request a transcode, it will attempt to direct play but fail. On the other hand, if you remove some of the details, the Android client assumes a transcode is necessary (by design) and it works as expected.
IMO, that suggests that either (a.) there is something wonky with that specific file that the Android client can’t handle, or (b.) the Android client’s direct-play/transcode logic needs tweaking.
With which version of the Android client are you testing? Also, which hardware and OS version?

Makes sense.  Plex/Web seems to struggle also, logs seem to point to the need for a duration parameter when direct playing with Plex/Web.  Does this sound correct?

Android:

Nexus 4

Android OS 4.3

Plex for Plexpass 3.1.4.39 (Downloaded this morning)

PMS:

Server Version 0.9.8.5

Latest Stable unRAID

I haven’t previously heard of clients requiring duration to be set for direct play.

Can you paste the XML generated for that video, with all the attributes populated? That may help to track down the reason you're seeing errors.