Jump to content

Should Live TV transcode?


simonselmer
Go to solution Solved by ebr,

Recommended Posts

simonselmer

Hi

 

My Live TV watching with Emby is not perfect. 

Watching Live TV can cause pauses, breaks, freezes, glitches.

Especially watching an ongoing recording, perhaps started 30 minutes before watching, gives issues as breaks and freezes, and sometimes the playing will stop, even though the recording is still ongoing. 

 

I'm trying to debug on this but it's a bit hard as there are many factors in play.

I tried watching Live TV on my TV through Emby, and at the same time, I was streaming directly from my network tuner to my laptop, so I was watching the same TV program, delayed a few seconds on Emby.

They only problem I caught here was a glitch on the Emby Live TV, which was not there on my durect-from-tuner stream. Just to eliminate that my tuner has an issue. Even though I only did that once. I need to test more.

 

BUT my first question in this debugging is, SHOULD my Live TV in Emby be transcoding or not??? Because of cause this put more stress on the system, than if transcoding could be avoided.

 

I tested Live TV from both Emby Theater on my laptop and on Emby for Android TV on Nvidia Shield, and both were being transcoded.

I attached the 2 server-logs, if anyone can help out and clairfy if transconding is OK and required, and if transcoding can be avoided or not.

 

Setup:

 - Tuner: HDHomeRun Expand - HDHR3-4DC

 - Server: Emby server on Synology DS918+

 - Client: Nvidia Shield

 

Best Regards Simon

ffmpeg-transcode-1451c0b2-f8c1-4e9d-b8e5-085a25b3a337_1.txt

ffmpeg-transcode-d38a8eb0-2ced-4742-9895-94d1fbeaf31f_1.txt

Link to comment
Share on other sites

somedude

It looks like it's coming in as a transport stream that the Shield (and theater) may not know what to do with.

 

Input #0, mpegts, from 'http://127.0.0.1:8096/LiveTv/LiveStreamFiles/9c2482c8c0bb4688b159b778cfbfbfae/stream.ts':
  Duration: N/A, start: 50372.007200, bitrate: N/A
  Program 200
    Stream #0:0[0x8df]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [sAR 1:1 DAR 16:9], Level 40, 50 fps, 50 tbr, 90k tbn, 100 tbc, Start-Time 50372.790s
    Stream #0:1[0x8e0](dan): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s, Start-Time 50372.174s
    Stream #0:2[0x8e1](dan): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s, Start-Time 50372.088s
    Stream #0:3[0x8e2](dan): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), Start-Time 50372.007s

 

While the players should be able to handle it, maybe the server doing it based on the container or audio.
 

I only have MPEG2 sources on cable/OTA here. Direct streams seem to work. h.264 is a different animal. I also see 50fps in the log. That may be a reason. Maybe the player wants to see something else, or, they haven't set "direct" to handle 50fps sources "natively"???

If I stream an h.264 .wtv file it's transcoded due to the container type being a .wtv file. Maybe there's something about the transport stream that the Shield and Theater don't understand?

Link to comment
Share on other sites

Hi.  Did you have the option in the Android TV app to direct stream Live TV disabled?

 

Also, did you check the dashboard at the time of playback to see what it said the reason for transcoding was?

Link to comment
Share on other sites

simonselmer

Hi

 

In dashboard, when transcoding TV, it does not give any reason.

 

But I now tried to enable "direct Live TV" in the Android TV app. Then on dashboard, I see it direct plays. When I try to pause, it of course says it canot be done, and asks if I want to switch to Seek Mode. When doing that, in the dashboard I see it again begins to transcode. But now with a reason for transcoding, saying  something like media bitrate is above limit.

 

On Android TV, with nerd stats, the Streaming Info says 8 Mbps, and Max bitrate setting is 110 Mb/s.

 

So does the Transcode log I attached not say exactly why it's transcoding?

Link to comment
Share on other sites

simonselmer

When I Watch TV from my Emby for Android app (mobile), it Direct Plays!  

 

So it's not isolated to Emby Server, but the transconding in my case is depended on my client.

 

But again, I dont understand why the nvidia shield client needs to transcoding. I would hope as one of the most powerfull clients devices, it would be able to use direct play as well.

Link to comment
Share on other sites

simonselmer

So, I have tried to just record a TV program, NOT watching it.

On the dashboard it not mention anything about transcoding. AND there is no transcoding log file (the ffmpeg-transcode log files).

So does that mean it is not transcoding when recording?

 

Then if I stop that recording, and play it, the dashboard shows it is Direct Streaming and gives this generic reason "The media is compatible with the device regarding resolution and media type (H.264, AC3, etc.), but is in an incompatible file container (.mkv, .avi, .wmv, etc.). The video will be re-packaged on the fly before streaming it to the device."

 

But watching the recorded program has generated a ffmpeg-remux log file. I want to attach it but I cannot see how I can do that, so I paste it below.

 

Are you able to tell why it direct Streams instead of direct plays? That could be a hit to why it transcodes, when watching live TV.

 

2019-11-01 10:22:27.549
Emby Server version: 4.2.1.0
 
App: AndroidTv 1.7.54g
SHIELD
 
 
{"Protocol":"File","Id":"e1fecd4ba65e0edafad5700417b70d34","Path":"/volume1/NAS_drev/Optaget TV/Go' morgen Danmark/Go' morgen Danmark 2019_11_01_06_30_00.ts","Type":"Default","Container":"mpegts","Size":331137024,"Name":"2019_11_01_06_30_00","IsRemote":false,"RunTimeTicks":2051820000,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":false,"MediaStreams":[{"Codec":"h264","ColorTransfer":"bt709","ColorPrimaries":"bt709","ColorSpace":"bt709","TimeBase":"1/90000","CodecTimeBase":"1/100","VideoRange":"SDR","DisplayTitle":"720p H264","NalLengthSize":"0","IsInterlaced":false,"IsAVC":false,"BitRate":12910932,"BitDepth":8,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":720,"Width":1280,"AverageFrameRate":50,"RealFrameRate":50,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","PixelFormat":"yuv420p","Level":40,"IsAnamorphic":false},{"Codec":"mp2","Language":"dan","TimeBase":"1/90000","CodecTimeBase":"1/48000","DisplayTitle":"Danish MP2 stereo","DisplayLanguage":"Danish","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":192000,"Channels":2,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","Level":0},{"Codec":"ac3","Language":"dan","TimeBase":"1/90000","CodecTimeBase":"1/48000","DisplayTitle":"Danish Dolby Digital 5.1","DisplayLanguage":"Danish","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":448000,"Channels":6,"SampleRate":48000,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":2,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","Level":0},{"Codec":"dvb_teletext","Language":"dan","TimeBase":"1/90000","CodecTimeBase":"0/1","Extradata":"00000000: 0900","DisplayTitle":"Danish (DVB_TELETEXT)","DisplayLanguage":"Danish","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":3,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Protocol":"File","Level":0}],"Formats":[],"Bitrate":12910932,"RequiredHttpHeaders":{},"ReadAtNativeFramerate":false}
 
User policy for Stue: EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
 
/var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -f mpegts -noaccurate_seek -i file:"/volume1/NAS_drev/Optaget TV/Go' morgen Danmark/Go' morgen Danmark 2019_11_01_06_30_00.ts" -threads 0 -map 0:0 -map 0:1 -sn -c:v:0 copy -copyts -vsync -1 -codec:a:0 aac -metadata:s:a:0 language=dan -disposition:a:0 default -ac:a:0 2 -ab:a:0 192000  -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 6  -individual_header_trailer 0 -break_non_keyframes 1 -segment_format mpegts -segment_write_temp 1 -segment_list_type m3u8 -segment_start_number 0 -segment_list "/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f5.m3u8" -y "/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f5%d.ts"
 
ffmpeg version 4.0.3-emby_2019_04_09-20190419T215104UTC Copyright © 2000-2018 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 7.3.0 (GCC)
Local Time: 09:22:27
T=0.000s
T=0.008s
[h264 @ 0x10234c0] SPS unavailable in decode_picture_timing
[h264 @ 0x10234c0] non-existing PPS 0 referenced
[h264 @ 0x10234c0] SPS unavailable in decode_picture_timing
[h264 @ 0x10234c0] non-existing PPS 0 referenced
[h264 @ 0x10234c0] decode_slice_header error
[h264 @ 0x10234c0] no frame!
 
.....
 
[mpegts @ 0x1004080] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from 'file:/volume1/NAS_drev/Optaget TV/Go' morgen Danmark/Go' morgen Danmark 2019_11_01_06_30_00.ts':
  Duration: 00:03:25.18, start: 12143.031822, bitrate: 12910 kb/s
  Program 200 
    Stream #0:0[0x8df]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [sAR 1:1 DAR 16:9], Level 40, 50 fps, 50 tbr, 90k tbn, 100 tbc, Start-Time 12143.994s
    Stream #0:1[0x8e0](dan): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s, Start-Time 12143.170s
    Stream #0:2[0x8e1](dan): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, 5.1(side), fltp, 448 kb/s, Start-Time 12143.053s
    Stream #0:3[0x8e2](dan): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250, Start-Time 12143.032s
T=0.136s
    Last message repeated 3 times
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
T=0.136s
Press [q] to stop, [?] for help
[segment @ 0x104c740] Opening '/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f50.ts.tmp' for writing
Output #0, segment, to '/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f5%d.ts':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [sAR 1:1 DAR 16:9], q=2-31, Level 40, 50 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1(dan): Audio: aac (LC), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      encoder         : Lavc58.18.100 aac
[segment @ 0x104c740] Opening '/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f5.m3u8.tmp' for writing
SegmentComplete=video:0 Index=0 Start=0.000000 End=6.003789 Duration=6.003789 offset_pts=0 start_pts=0 Frames=236 filename=e4a5ed4a1a10bfb63939482b7dda30f50.ts
[segment @ 0x104c740] Opening '/var/packages/EmbyServer/target/var/transcoding-temp/e4a5ed4a1a10bfb63939482b7dda30f51.ts.tmp' for writing
elapsed=00:00:00.50 frame=  498 fps=0.0 q=-1.0 size=   14470kB time=00:00:11.18 bitrate=10599.2kbits/s throttle=off speed=22.3x    
Link to comment
Share on other sites

A remux is what I would have expected.  I cannot see why your other program was transcoding unless, perhaps, there was an error trying to just remux it. 

 

.ts containers are not truly seekable so we remux it to provide reliable seeking ability.  This requires very little resources on your server.

Link to comment
Share on other sites

simonselmer

So I have done some more testing, with extended logging, but I dont find any direct clues.

I attach here the extended emby server log and the transcoding log when starting a Live TV program.

 

 

In the extended log it say "VideoBitrate=109808000". I assume that is my client MAX bitrate, NOT that it think the stream itself is almost 110 Mb/sec?

 

What does this mean "VideoStreamCopy=false"?

 

In this line "2019-11-01 14:28:38.050 Info App: ProcessRun 'StreamTranscode 3fbf99' Execute:", I assume it means here it starts the actual transcoding.

And in that line it says "maxrate 8000000". Is that max 8mbit??

 

Emby extended server log.txt

ffmpeg-transcode-3fbf999e-2de4-4668-ab86-c25134f2c8bc_1.txt

Link to comment
Share on other sites

That isn't a complete server log...

 

Do you have other devices watching this same channel at the same time?  It looks like that is what is happening and that could affect how it is played.

Link to comment
Share on other sites

simonselmer

Your right, I only copy pasted the past around the time of the TV watching test because I thought the log was so huge, so here you go, the full Emby log from today.

 

Only my sister is also watching TV remotely through my Emby. She is using the Emby for Android app on her LG Android TV. And I noticed yesterday that she is direct streamning/playning when watching TV from me.

 

But she has not been watching TV from me today, so no, there should not be more users at the same time.

Only me testing it on my Nvidia Shield (where the emby user is called "Stue") and on my Samsung mobile (with my own emby user "Simon")

embyserver.txt

Link to comment
Share on other sites

simonselmer

I just played around with several of the settings in the emby app (shield), and I tried enable the "Allow Stream copy" option.

After enabling that, it now "direct plays" instead of transcoding!?!

 

I also tried recoding a TV program, waited 10 seconds and then tried playing that from beginning, and still it direct plays.

 

After messing around with that, I also notice that now I only have "remux"-logs, no "transcoding"-logs.

 

I dont know if that solves my issues, I will have to test tonight by watching a longer TV show, but can you explain what does that "Allow Stream Copy"-toption actually do?

What the the pro and cons of that option?

Link to comment
Share on other sites

  • Solution

I just played around with several of the settings in the emby app (shield), and I tried enable the "Allow Stream copy" option.

After enabling that, it now "direct plays" instead of transcoding!?!

 

I also tried recoding a TV program, waited 10 seconds and then tried playing that from beginning, and still it direct plays.

 

After messing around with that, I also notice that now I only have "remux"-logs, no "transcoding"-logs.

 

I dont know if that solves my issues, I will have to test tonight by watching a longer TV show, but can you explain what does that "Allow Stream Copy"-toption actually do?

What the the pro and cons of that option?

 

Okay, so you had disabled the option that allows it to not transcode (Allow Video Stream Copy).  How could we have made this more obvious and why did you disable that?

Link to comment
Share on other sites

simonselmer

Hi. I'm sorry if I'm the one that has disabled that, in that case it's long time ago and have not thought about, because the name of the option is not clear to me.

I recall perhaps after installing the server I had some issues watching Live TV, about pausing and continue playing or similar, and I think that disabled that option worked better.

 

But from the name "Allow Video Stream Copy", it is not clear to me what it means and what it does. If it had said "Do not allow transcoding" that would of course be much more obvious.

Wouldn't that be good to have in the server log as well for debugging? Saying " Video Stream not allowed, begin transcoding".

 

It worked a lot better yesterday evening. Only with a few 1-2 second freezes, but not with any glitches and much longer freezes I have seen priviously.

 

Thank you for alle your the help on the debugging.

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...