Jump to content

When remux and transcoding audio


Recommended Posts

Posted

Hi,

 

Just for me curiosity:

What are the rules for transcoding the audio. I have got the impression that when you don't choose the primary audio stream (all streams DTS) it transcodes it to AC3. When choosing it seems to keep the stream in DTS format.

 

Using QNAP server and the Emby LG app

 

Isn't it possible to keep the DTS stream when remuxing the streams?

 

Was not sure in which group to post, so I posted in General

 

Vincent

 

 

 

Guest asrequested
Posted

It all depends on what the app/device, supports. If they can play DTS, then it will. If not, the server will transcode it.

Posted

It all depends on what the app/device, supports. If they can play DTS, then it will. If not, the server will transcode it.

The app (LG app) supports DTS, when using the first audio stream it remains DTS when remuxing, choosing another DTS it gets transcoded to AC3 (I allow audio transcoding for other devices, such as chromebook)

 

I will investigate some more myself...

Posted

When we remux we use the HLS format, and this does not support carrying DTS.

Posted (edited)

When we remux we use the HLS format, and this does not support carrying DTS.

Oke, that explains somethings...

 

So a MKV with 1 DTS audio stream isn't remuxed and remains DTS, every other MKV with multiple audiostreams gets remuxed?

For this media file log states actually 2 things: Unknown Profile and secundary audio stream.

 

Just trying to understand the behavor. Because not all MKV are remuxed when using the LG app

Edited by Quiptix
Posted

We'd have to look at a specific example. Thanks.

Posted

We'd have to look at a specific example. Thanks.

I will find some examples as not all MKV's are remuxed when using the LG app

Posted

The most recent example is a media file with 3 DTS audio streams:

Output of ffmpeg -i :

<ision Course.2016] # ffmpeg -i Ice\ Age\ 5\ Collision\ Course.2016.1080p.H264.mkv                                    
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-cross-compile --arch=i686 --target-os=linux --disable-yasm --disable-static --enable-shared --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libvo-aacenc --enable-libsoxr --enable-version3 --enable-nonfree --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-decoder=eac3 --disable-decoder=dca --disable-decoder=truehd --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-encoder=dca --extra-ldflags='-L/root/daily_build/64_27/4.3.3/Model/TS-269/build/RootFS/usr/local/medialibrary/lib -Wl,--rpath -Wl,/usr/local/medialibrary/lib' --extra-cflags='-I/root/daily_build/64_27/4.3.3/Model/TS-269/build/RootFS/usr/local/medialibrary/include -D_GNU_SOURCE -DQNAP' --prefix=/root/daily_build/64_27/4.3.3/Model/TS-269/build/RootFS/usr/local/medialibrary
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : 5.1
Guessed Channel Layout for  Input Stream #0.2 : 5.1
Guessed Channel Layout for  Input Stream #0.3 : 5.1
Input #0, matroska,webm, from 'Ice Age 5 Collision Course.2016.1080p.H264.mkv':
  Metadata:
    title           : Ice.Age.5.Collision.Course.2016.1080p.BluRay.DTS.x264-MoBee1
    encoder         : libebml v1.3.1 + libmatroska v1.4.2
    creation_time   : 2016-10-24 04:19:51
  Duration: 01:34:32.77, start: 0.000000, bitrate: 7004 kb/s
    Chapter #0:0: start 0.000000, end 189.106000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 189.106000, end 324.366000
    Metadata:
      title           : 00:03:09.106
    Chapter #0:2: start 324.366000, end 546.087000
    Metadata:
      title           : 00:05:24.366
    Chapter #0:3: start 546.087000, end 802.301000
    Metadata:
      title           : 00:09:06.087
    Chapter #0:4: start 802.301000, end 1085.751000
    Metadata:
      title           : 00:13:22.301
    Chapter #0:5: start 1085.751000, end 1250.583000
    Metadata:
      title           : 00:18:05.751
    Chapter #0:6: start 1250.583000, end 1390.306000
    Metadata:
      title           : 00:20:50.583
    Chapter #0:7: start 1390.306000, end 1649.898000
    Metadata:
      title           : 00:23:10.306
    Chapter #0:8: start 1649.898000, end 1815.981000
    Metadata:
      title           : 00:27:29.898
    Chapter #0:9: start 1815.981000, end 1974.347000
    Metadata:
      title           : 00:30:15.981
    Chapter #0:10: start 1974.347000, end 2173.588000
    Metadata:
      title           : 00:32:54.347
    Chapter #0:11: start 2173.588000, end 2373.454000
    Metadata:
      title           : 00:36:13.588
    Chapter #0:12: start 2373.454000, end 2578.701000
    Metadata:
      title           : 00:39:33.454
    Chapter #0:13: start 2578.701000, end 2855.019000
    Metadata:
      title           : 00:42:58.701
    Chapter #0:14: start 2855.019000, end 3071.735000
    Metadata:
      title           : 00:47:35.019
    Chapter #0:15: start 3071.735000, end 3350.764000
    Metadata:
      title           : 00:51:11.735
    Chapter #0:16: start 3350.764000, end 3669.457000
    Metadata:
      title           : 00:55:50.764
    Chapter #0:17: start 3669.457000, end 3906.402000
    Metadata:
      title           : 01:01:09.457
    Chapter #0:18: start 3906.402000, end 4179.300000
    Metadata:
      title           : 01:05:06.402
    Chapter #0:19: start 4179.300000, end 4476.889000
    Metadata:
      title           : 01:09:39.300
    Chapter #0:20: start 4476.889000, end 4661.532000
    Metadata:
      title           : 01:14:36.889
    Chapter #0:21: start 4661.532000, end 4903.065000
    Metadata:
      title           : 01:17:41.532
    Chapter #0:22: start 4903.065000, end 5086.498000
    Metadata:
      title           : 01:21:43.065
    Chapter #0:23: start 5086.498000, end 5672.768000
    Metadata:
      title           : 01:24:46.498
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1920x800 [SAR 1:1 DAR 12:5], 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default) (forced)
    Metadata:
      title           : Ice Age 5: Collision Course (2016) 1080p @ ~ 4000 Kbps
      BPS             : 3956981
      BPS-eng         : 3956981
      DURATION        : 01:34:32.676000000
      DURATION-eng    : 01:34:32.676000000
      NUMBER_OF_FRAMES: 136008
      NUMBER_OF_FRAMES-eng: 136008
      NUMBER_OF_BYTES : 2805834402
      NUMBER_OF_BYTES-eng: 2805834402
      _STATISTICS_WRITING_APP: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_DATE_UTC: 2016-10-24 04:19:51
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-10-24 04:19:51
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: dts, 48000 Hz, 6 channels (default)
    Metadata:
      title           : English DTS-ES 5.1 @ 1536 Kbps
      BPS             : 1508999
      BPS-eng         : 1508999
      DURATION        : 01:34:27.670000000
      DURATION-eng    : 01:34:27.670000000
      NUMBER_OF_FRAMES: 531344
      NUMBER_OF_FRAMES-eng: 531344
      NUMBER_OF_BYTES : 1069064128
      NUMBER_OF_BYTES-eng: 1069064128
      _STATISTICS_WRITING_APP: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_DATE_UTC: 2016-10-24 04:19:51
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-10-24 04:19:51
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(dut): Audio: dts, 48000 Hz, 6 channels
    Metadata:
      title           : Nederlands (Dutch) DTS 5.1 @ 768 Kbps
      BPS             : 767998
      BPS-eng         : 767998
      DURATION        : 01:34:32.768000000
      DURATION-eng    : 01:34:32.768000000
      NUMBER_OF_FRAMES: 531821
      NUMBER_OF_FRAMES-eng: 531821
      NUMBER_OF_BYTES : 544584704
      NUMBER_OF_BYTES-eng: 544584704
      _STATISTICS_WRITING_APP: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_DATE_UTC: 2016-10-24 04:19:51
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-10-24 04:19:51
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(dut): Audio: dts, 48000 Hz, 6 channels
    Metadata:
      title           : Vlaams (Flemish) DTS 5.1 @ 768 Kbps
      BPS             : 767998
      BPS-eng         : 767998
      DURATION        : 01:34:32.768000000
      DURATION-eng    : 01:34:32.768000000
      NUMBER_OF_FRAMES: 531821
      NUMBER_OF_FRAMES-eng: 531821
      NUMBER_OF_BYTES : 544584704
      NUMBER_OF_BYTES-eng: 544584704
      _STATISTICS_WRITING_APP: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_DATE_UTC: 2016-10-24 04:19:51
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-10-24 04:19:51
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:4(dut): Subtitle: subrip (default)
    Metadata:
      title           : Nederlandse ondertiteling (Dutch retail subs)
      BPS             : 54
      BPS-eng         : 54
      DURATION        : 01:23:44.977000000
      DURATION-eng    : 01:23:44.977000000
      NUMBER_OF_FRAMES: 1068
      NUMBER_OF_FRAMES-eng: 1068
      NUMBER_OF_BYTES : 34315
      NUMBER_OF_BYTES-eng: 34315
      _STATISTICS_WRITING_APP: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_APP-eng: mkvmerge v7.7.0 ('Six Voices') 64bit built on Feb 28 2015 23:39:33
      _STATISTICS_WRITING_DATE_UTC: 2016-10-24 04:19:51
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-10-24 04:19:51
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

When I select in the Emby LG app to play the default (english) DTS stream Emby Direct Streams the MKV without any remuxing and transcoding. When selecting the second DTS (dutch) audio stream it remuxes the media ending up transcoding the DTS, due to HLS. These lines appear in the log:

2017-12-30 23:08:52.217 Info App: User policy for Vincent. EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: False EnableAudioPlaybackTranscoding: True
2017-12-30 23:08:52.217 Info App: Profile: Unknown Profile, Path: /share/Multimedia/Movies/Ice Age 5 Collision Course.2016/Ice Age 5 Collision Course.2016.1080p.H264.mkv, isEligibleForDirectPlay: True, isEligibleForDirectStream: True
2017-12-30 23:08:52.217 Info App: Profile: VideoAudioCodecProfile, DirectPlay=false. Reason=Unknown Profile.IsSecondaryAudio Condition: Equals. ConditionValue: false. IsRequired: False. Path: /share/Multimedia/Movies/Ice Age 5 Collision Course.2016/Ice Age 5 Collision Course.2016.1080p.H264.mkv

Am getting it, I think!

I assume this is because of the limitations of the Emby app or LG player for selecting which stream to use. If we depend on the LG media player then it is a fact of life unless you write your own player.

 

So practically, if I want the dutch DTS to be used I have to reconstruct the MKV so that the dutch DTS becomes the first/primary stream. (Or the only audio stream)

 

Is this something the Emby could do? A Handbrake built into Emby, just to shuffle streams?

 

(Still full of ideas) ;-)

 

Vincent

Guest asrequested
Posted

You wouldn't need to transcode it. It's really quick and easy to remux an MKV. Try mkvtoolnix. It may also be a condition of which track is marked as default. If you open in it in the header editor of mkvtoolnix, you can change the default and save, without having to remux at all. I would try that, first. But remuxing is very quick.

Posted (edited)

You wouldn't need to transcode it. It's really quick and easy to remux an MKV. Try mkvtoolnix. It may also be a condition of which track is marked as default. If you open in it in the header editor of mkvtoolnix, you can change the default and save, without having to remux at all. I would try that, first. But remuxing is very quick.

Good suggestion. I'm familiar with mkvtoolnix, so I give that a shot for now.

 

But... With the same file something interesting happens. When setting the second DTS (dutch) stream as default, the following behavor occurs on the LG:

Stream 1 selected: I get a transcoded version of Audio track 1 (english)

Stream 2 (which is default now) selected: I get a direct stream of Stream 1 in DTS

Stream 3 selected: I get a transcoded version of Audio track 3 (flemish)

 

When selecting stream 2, Dutch DTS which is marked as default, it won't get remuxed by Emby, however the LG app, gets the direct stream (mkv) and plays audio track 1 (despite not being default), so my assuption is that the LG app only plays the first audio stream.

I have checked the assumption to re-number the audio tracks as such that dutch DTS is the first audio stream and behold: Dutch DTS directly streamed.

 

Only now the descriptions of the streams are mixed up...

 

Vincent

Edited by Quiptix
Posted

With all this I probably found a bug in how to meta-data is build up.

Scanning for meta-data it orders the audio streams on ID and not by track-number.

 

I have no hard evidence at the moment, but will take a look into it.

Posted

We use the order that we are given from ffprobe.

Posted (edited)

We use the order that we are given from ffprobe.

It sounds a bit like this issue.

 

https://emby.media/community/index.php?/topic/46763-theater-mpv-test/?p=4697

Tested it, and the order doesn't change in the output of ffprobe. Probably looking at ID numbers.

 

Seems pretty similar!

Edited by Quiptix

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