Jump to content

Using NAR (Narrated) Audio stream instead of English


benjamoomin

Recommended Posts

benjamoomin

Hi, I've got an issue when I play live TV through Emby on some channels it is defaulting to the narrated audio descriptive type audio stream (NAR) instead of the standard English (eng) stream as I'd like.

I've updated my mpextended to 0.6.1 beta as per the pinned post by @@pünktchen but that hasn't made a difference. In mpextended config, in the Streaming section I have the Default Audio Language set to "en (English)" 

 

The channel I'm testing with this issue with is ITV2 (I'm in the UK) via freesat. When I try this channel through mediaportal it defaults to the Eng stream correctly, but (i'm not sure if this is important) I have noticed that if I go to select Audio Languange the NAR stream is number 1 and the Eng is number 2 in the list. Could it be defaulting to the first stream it comes across instead of select my preference of an English stream?

 

I should probably note that I've using primarily the Android TV app on a Nexus Player but also tested this out on the web gui, same NAR stream is selected via both methods.

 

Any help here would be really appreciated! Thanks

Link to comment
Share on other sites

pünktchen

Can you post please the Emby server log!

I guess i know what the problem is...

 

@@Luke what's the letter code that Emby expects from MediaSourceInfo for audio - en, eng or englisch?

Link to comment
Share on other sites

benjamoomin

Attached are the transcode and server logs for when I've just tried to view itv2 and it selected the NAR audio. 

 

The following bit from the transcode log is the part where it is selecting the audio stream to use (I think!)

    Stream #0:0[0x30]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x40](NAR): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:2[0x41](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:3[0x50](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:4[0x62](eng,eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
[libx264 @ 054df4a0] using SAR=404/405
[libx264 @ 054df4a0] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 054df4a0] profile High, level 4.1
Output #0, hls, to 'C:\Users\admin\AppData\Roaming\MediaBrowser-Server\transcoding-temp\383f859adc188f58a109eda54de6a4ce.m3u8':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 720x404 [SAR 404:405 DAR 16:9], q=-1--1, max. 1000 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.49.101 libx264
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc56.49.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))

server-63581141399.txt

transcode-951d9d9e-fd50-4bc8-ac18-3cf5ec69fd80.txt

Link to comment
Share on other sites

pünktchen

Hi @@Luke,

i've modified the MediaPortal plugin to match the language codes of Emby, but the user profile settings for audio selection isn't respected.

 

Also there's another problem i need your help.

This is from server log when i start a live tv stream with two audio streams:

2015-10-24 00:43:22.4113 Info - App: HttpClientManager GET: http://192.168.0.3:4322/MPExtended/StreamingService/json/GetMediaInfo?type=TV&itemId=TV-45-20151023224318&provider=0
2015-10-24 00:43:22.6513 Info - App: Live stream info: {"Protocol":"Http","Id":"45","Path":"http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318","Type":"Default","Container":"ts","RunTimeTicks":0,"ReadAtNativeFramerate":true,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":false,"RequiresOpening":false,"RequiresClosing":true,"LiveStreamId":"e2c02591b55c6b121fb0f65056883a50_45","MediaStreams":[{"Codec":"H264","IsInterlaced":true,"IsDefault":false,"IsForced":false,"Height":1080,"Width":1920,"Profile":"baseline","Type":"Video","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":40},{"Codec":"AC3","Language":"ger","IsInterlaced":false,"Channels":6,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false},{"Codec":"AC3","Language":"eng","IsInterlaced":false,"Channels":2,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":7000000,"RequiredHttpHeaders":{}}
2015-10-24 00:43:22.6713 Info - App: Profile: Unknown Profile, Path: http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318, isEligibleForDirectPlay: True, isEligibleForDirectStream: True
2015-10-24 00:43:22.6713 Info - App: Profile: Unknown Profile, No direct play profiles found for Path: http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318
2015-10-24 00:43:22.6713 Info - HttpServer: HTTP Response 200 to 127.0.0.1. Response time: 3995.2285 ms.
	Url: http://127.0.0.1:8096/emby/LiveStreams/Open?UserId=7a2a359b67d44419a168df243e2b6715&StartTimeTicks=0&ItemId=8d2d103aaf4186ebe1c4102a73c9cc02&PlaySessionId=386d7a7c696a401da32b26972ae51ac9
2015-10-24 00:43:22.6973 Info - App: HttpClientManager GET: http://192.168.0.3:4322/MPExtended/TVAccessService/json/GetProgramsDetailedForChannel?channelId=98&starttime=2015-10-23T23:43:22&endtime=2015-11-06T22:43:22
2015-10-24 00:43:22.7673 Info - HttpServer: HTTP GET http://127.0.0.1:8096/emby/videos/8d2d103aaf4186ebe1c4102a73c9cc02/stream.webm?DeviceId=152c388a370467f447a35c63ac26b53c8e67843f&MediaSourceId=45&VideoCodec=vpx&AudioCodec=vorbis&AudioStreamIndex=-1&VideoBitrate=548251429&AudioBitrate=320000&MaxHeight=1080&ClientTime=635812370026713824&PlaySessionId=386d7a7c696a401da32b26972ae51ac9&api_key=4e83c8c2cf504eb49e169f69529ac2b2&LiveStreamId=1a755974de5dc3461dc6ecae8ddec68b_e2c02591b55c6b121fb0f65056883a50_45&EnableAutoStreamCopy=false
	Ip: 127.0.0.1:18362. Headers: Host=127.0.0.1:8096,User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0,Accept=video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5,Accept-Language=en-US,en;q=0.5,Range=bytes=0-,Connection=keep-alive
2015-10-24 00:43:22.8353 Info - App: C:\Users\Administrator\AppData\Roaming\MediaBrowser-Server\ffmpeg\20150918\ffmpeg.exe -fflags +genpts -async 1 -vsync -1 -re -i "http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318" -sn -codec:v:0 libvpx -force_key_frames expr:gte(t,n_forced*5) -vf "yadif=0:-1:0,scale=trunc(oh*a/2)*2:min(ih\,1080)" -pix_fmt yuv420p -speed 16 -quality good -profile:v 0 -slices 8 -crf 10 -qmin 0 -qmax 50 -maxrate:v 8000000 -bufsize:v (8000000*2) -b:v 8000000 -vsync vfr -map_metadata -1 -threads 3 -codec:a:0 libvorbis -ab 320000 -af "aresample=async=1000" -y "D:\Transcoding_Temp\transcoding-temp\411177a0b23c9912f3f75732f45401ac.webm"

As you can see, there are two audio streams - "ger , index 0" and "eng , index 1"

But the transcoding engine sets both audio streams to "index -1" and outputs always the first audio stream. Because of this it's not possible to switch audio in the players.

http://127.0.0.1:8096/emby/videos/8d2d103aaf4186ebe1c4102a73c9cc02/stream.webm?DeviceId=152c388a370467f447a35c63ac26b53c8e67843f&MediaSourceId=45&VideoCodec=vpx&AudioCodec=vorbis&AudioStreamIndex=-1&VideoBitrate=548251429&AudioBitrate=320000&MaxHeight=1080&ClientTime=635812370026713824&PlaySessionId=386d7a7c696a401da32b26972ae51ac9&api_key=4e83c8c2cf504eb49e169f69529ac2b2&LiveStreamId=1a755974de5dc3461dc6ecae8ddec68b_e2c02591b55c6b121fb0f65056883a50_45&EnableAutoStreamCopy=false

{"Protocol":"Http","Id":"45","Path":"http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318","Type":"Default","Container":"ts","RunTimeTicks":0,"ReadAtNativeFramerate":true,"SupportsTranscoding":true,"SupportsDirectStream":false,"SupportsDirectPlay":false,"RequiresOpening":false,"RequiresClosing":true,"LiveStreamId":"1a755974de5dc3461dc6ecae8ddec68b_e2c02591b55c6b121fb0f65056883a50_45","MediaStreams":[{"Codec":"H264","IsInterlaced":true,"BitRate":8000000,"IsDefault":false,"IsForced":false,"Height":1080,"Width":1920,"Profile":"baseline","Type":"Video","Index":-1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":40},{"Codec":"AC3","Language":"ger","IsInterlaced":false,"Channels":6,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":-1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false},{"Codec":"AC3","Language":"eng","IsInterlaced":false,"Channels":2,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":-1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":7000000,"RequiredHttpHeaders":{}}

C:\Users\Administrator\AppData\Roaming\MediaBrowser-Server\ffmpeg\20150918\ffmpeg.exe -fflags +genpts -async 1 -vsync -1 -re -i "http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318" -sn -codec:v:0 libvpx -force_key_frames expr:gte(t,n_forced*5) -vf "yadif=0:-1:0,scale=trunc(oh*a/2)*2:min(ih\,1080)" -pix_fmt yuv420p -speed 16 -quality good -profile:v 0 -slices 8 -crf 10 -qmin 0 -qmax 50 -maxrate:v 8000000 -bufsize:v (8000000*2) -b:v 8000000 -vsync vfr -map_metadata -1 -threads 3 -codec:a:0 libvorbis -ab 320000 -af "aresample=async=1000" -y "D:\Transcoding_Temp\transcoding-temp\411177a0b23c9912f3f75732f45401ac.webm"


ffmpeg version N-75410-g58fe57d Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/mceuser/ffmpeg-windows-build-helpers/sandbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32threads --enable-gpl --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-libvidstab --enable-libx265 --enable-decklink --extra-libs=-loleaut32 --enable-libx264 --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-libdcadec --enable-avisynth --enable-gray --enable-libmfx --extra-libs=-lpsapi --extra-cflags= --enable-static --disable-shared --prefix=/home/mceuser/ffmpeg-windows-build-helpers/sandbox/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-runtime-cpudetect
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  3.100 / 57.  3.100
  libavformat    57.  2.100 / 57.  2.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  5.100 /  6.  5.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100

Input #0, mpegts, from 'http://192.168.0.3:4322/MPExtended/StreamingService/stream/RetrieveStream?identifier=TV-45-20151023224318':
  Duration: N/A, start: 2.064878, bitrate: N/A
  Program 137 
    Stream #0:0[0x30]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x40](ger): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x41](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 384 kb/s
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
[libvpx @ 0000000005b1e540] v1.4.0
Output #0, webm, to 'D:\Transcoding_Temp\transcoding-temp\411177a0b23c9912f3f75732f45401ac.webm':
  Metadata:
    encoder         : Lavf57.2.100
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=0-50, 8000 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.3.100 libvpx
    Stream #0:1: Audio: vorbis (libvorbis), 48000 Hz, 5.1(side), fltp, 320 kb/s
    Metadata:
      encoder         : Lavc57.3.100 libvorbis
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> vp8 (libvpx))
  Stream #0:1 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help

What i am missing?

  • Like 2
Link to comment
Share on other sites

make sure you're not reporting any duplicate stream indexes because then the server will assume you're giving bad input and set them all to -1. compare to a working video file.

Link to comment
Share on other sites

pünktchen

Ah okay, if the video stream has an index 0, the audio streams have to start with 1 and not with 0.

I think i got audio switching working while direct playing on my Android tablet, but of course i can't hear any difference between stereo and ac3.

 

When playing tv in a browser (stream gets transcoded) and i try to switch the audio streams,

the playback stops with an error!

Link to comment
Share on other sites

because they need to be the exact order and that is probably the issue. if the audio stream appears first in the container, are you reflecting that in your stream indexes? i am guessing you are not. we used to probe all live tv streams for exact info but for many this wound up being too slow so we had to remove it. now we only do it for the built-in live tv. if MP interrogates the stream when it is opened, then you should tap into that information. if it does not then you are probably stuck for right now and should omit them from the media info in order to avoid errors.

 

clients that direct play can generally get media info from the video player which can allow this to be solved client-side on a per app basis. when transcoding is used, the server needs to know up front ahead of time. it is possible for the server to collect the info after transcoding has started but that represents a fundamental shift in the api because we then have to get that information passed down to client apps after they've started playing.

Link to comment
Share on other sites

pünktchen

Thank you for your lengthy explanation!

The order of stream indexes in general is correct, but MP delivers 0,1,2... for video AND 0,1,2,3... for audio. So it always starts with 0 for every stream type (subtitles also). As a workaround i count the audio indexes +1 in the plugin. That shouldn't be a problem because it doesn't change the order?!

Link to comment
Share on other sites

pünktchen

Hi @@benjamoomin

i've just uploaded another version to Embys plugin catalogue, that should respect the prefered audio language settings within your Emby user profile.

Unfortunatally right now you cannot switch the audio stream when Emby transcodes your live tv. This one needs further inspection by me...

  • Like 1
Link to comment
Share on other sites

pünktchen

@@Luke

Sorry for all my annoying questions, but i really want to get this fixed!

The pre selection of the audio stream by language settings is working right now, but when i try to switch the audio stream while Emby is transcoding, playback is canceled.

This also happens if i try to change the transcoding bitrate!

562d6cf70ecbd_Unbenannt.png

 

So i really need to know what happens in detail in the background if i do something from above.

Is the live tv stream closed by the transcoding engine to get restarted with other options?

Are the mediainfos demanded a second time by the transcoding engine?

What methodes are called by Emby the time i change the stream? (eg. public Task<MediaSourceInfo> GetChannelStream())

 

I'm really curious about your answer.

Link to comment
Share on other sites

yes it will end up closing and reopening the stream because we feed the url directly to ffmpeg. when ffmpeg stops the stream closes.

Link to comment
Share on other sites

pünktchen

yes it will end up closing and reopening the stream because we feed the url directly to ffmpeg. when ffmpeg stops the stream closes.

Okay so either you close the stream and feed ffmpeg with the url of the previous stream without really restarting a new stream or you start a new live tv stream and it is just to fast. MP hasn't closed the previous stream while you are demanding another one -> no free tuner available! Edited by pünktchen
Link to comment
Share on other sites

The get channel stream method is only called once but the video player may disconnect and reconnect using the same url

Link to comment
Share on other sites

benjamoomin

Hi @@pünktchen, sorry for the delayed response, but yes the latest update now means that the English stream is always selected now instead of the NAR steam. Thanks very much! Good luck trying to get the switching between audio streams to work.

 

As a side issue I was messing about and removed and reinstall the mediaportal plugin for emby and now I can't seemingly get the channels to sort correctly by Default (as defined by the channel group set up in the mp tv server). Regardless of the sort order I select in the emby plugin it seems to always sort by channel number. Any ideas how I can rectify this?

Link to comment
Share on other sites

  • 3 weeks later...
pünktchen

Hi @@pünktchen, sorry for the delayed response, but yes the latest update now means that the English stream is always selected now instead of the NAR steam. Thanks very much! Good luck trying to get the switching between audio streams to work.

 

As a side issue I was messing about and removed and reinstall the mediaportal plugin for emby and now I can't seemingly get the channels to sort correctly by Default (as defined by the channel group set up in the mp tv server). Regardless of the sort order I select in the emby plugin it seems to always sort by channel number. Any ideas how I can rectify this?

Sorry for the late response!

With the next plugin update you get a setting to enable channel index numbers. Probably you have to clear your browser cache to see the setting.

Link to comment
Share on other sites

  • 4 months later...
benjamoomin

Hi I'm having similar issues again where the NAR audio is being used be default instead of the ENG audio

 

Attached are server and trancode logs. I restart the server before testing so should just have relevant logs.

 

13:50 trying to view channel itv2 on PC (same box as emby server) via chrome - ENG selected by default

13:53 viewing itv2 from Android app - NAR selected by default

 

Also attached are screenshots from the browser and the app

 

post-49594-0-12151700-1460207004_thumb.png

post-49594-0-80098000-1460207004_thumb.png

 

Can be a bit frustrating as I also use the Android TV app which currently won't let me change the audio track, but that's a different issue :)

server-63595806611.txt

transcode-af1210a4-4ee5-428e-8dc2-47b688052f3e.txt

Link to comment
Share on other sites

pünktchen

I can't do anything in the plugin about this. The first audio track in the stream is always set as default track - in your case it is "nar".

So if you have set "english" as your prefered language and disabled "use default audio track regardless of language" in the playback settings of your user profile, it should work the way you want it to and select the "eng" track.

It's seems that the Android app does not respect your user profile settings!

Link to comment
Share on other sites

benjamoomin

Thanks @@pünktchen. I'll raise it in the android app and android tv app forums. As a thought is there any way for this plugin to change the order of audio tracks? For example always make the NAR track come last, forcing it to be stream 9 or something similar? Thanks

Link to comment
Share on other sites

Spaceboy

Having similar problems still with Dvblink and the android app. Not getting any help unfortunately

Edited by Spaceboy
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...