Page 1 of 1

Audio stream deleted when transcoding .avi file

PostPosted: Thu Dec 29, 2022 1:19 pm
by flavius
Hi, I'm using serviio 2.3 on Windows 10 and want to send an .avi file to a Samsung UE55D8000 TV.
ffmpeg info on .avi file:
Input #0, avi, from '.\03.02.16_08.46.avi':
Duration: 00:02:05.04, start: 0.000000, bitrate: 29839 kb/s
Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s

ffmpeg info on transcoded file:
Duration: 00:02:05.00, start: 1.440000, bitrate: 20400 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], max. 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc

The audio stream has been deleted by the transcoding process.
Please advice how to modify profiles.xml to get the audio included in the transcoded file.

The log file shows the following ffmpeg command line, and I suppose the -an option discards the audio stream:
2022-12-29T13:24:40,584 DEBUG [ProcessExecutor] Starting F:\Programme\Streaming\Serviio\bin\\..\lib\ffmpeg.exe -threads 0 -i T:\Video_T\Mini-DV-Kassetten\03\02\16\03.02.16_08.46.avi -y -threads 0 -c:v mpeg2video -pix_fmt yuv420p -qscale:v 1 -r 25 -g 15 -an -map 0:0 -sn -f mpegts C:\Windows\TEMP\Serviio\transcoding-temp-affe42765de853a253be3eddeb2b75da.stf

Other infos from log file:
2022-12-29T13:24:40,583 DEBUG [VideoDeliveryEngine] Delivering item '149758' for client 'Identifier=192.168.35.55, Profile=Samsung TV / player (C/D-series), Name=UE55D8000'
2022-12-29T13:24:40,583 DEBUG [AbstractAVTranscodingDeliveryEngine] No suitable transcoding job exists yet, start one for client 'Identifier=192.168.35.55, Profile=Samsung TV / player (C/D-series), Name=UE55D8000'
2022-12-29T13:24:40,584 DEBUG [FFMPEGWrapper] Invoking FFmpeg to transcode video file: T:\Video_T\Mini-DV-Kassetten\03\02\16\03.02.16_08.46.avi
2022-12-29T13:24:40,584 DEBUG [ProcessExecutor] Starting F:\Programme\Streaming\Serviio\bin\\..\lib\ffmpeg.exe -threads 0 -i T:\Video_T\Mini-DV-Kassetten\03\02\16\03.02.16_08.46.avi -y -threads 0 -c:v mpeg2video -pix_fmt yuv420p -qscale:v 1 -r 25 -g 15 -an -map 0:0 -sn -f mpegts C:\Windows\TEMP\Serviio\transcoding-temp-affe42765de853a253be3eddeb2b75da.stf
2022-12-29T13:24:41,585 DEBUG [FileBasedTranscodingDeliveryStrategy] Sending transcoding stream
2022-12-29T13:24:41,585 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file "03.02.16_08.46.avi": MPEG_TS_SD_EU_ISO
2022-12-29T13:24:41,585 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file "03.02.16_08.46.avi": MPEG_TS_SD_NA_ISO
2022-12-29T13:24:41,585 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file "03.02.16_08.46.avi": MPEG_TS_SD_KO_ISO
2022-12-29T13:24:41,586 DEBUG [VideoDeliveryEngine] Delivering file '03.02.16_08.46.avi' using transcoding (profile: 7 > quality: ORIGINAL > Transcoding > [MPEG2TS/MPEG2/LPCM] > matcher: 1)
2022-12-29T13:24:41,586 DEBUG [GETMethodProcessor] Stream entity has length: 50000000000
2022-12-29T13:24:41,586 INFO [PlaybackEventsManager] Playback of media item 149758 (03.02.16_08.46 [03.02.16_08.46.avi]) has started at 0% on Identifier=192.168.35.55, Profile=Samsung TV / player (C/D-series), Name=UE55D8000

Relevant lines from profiles.xml:
<Transcoding>
<!-- HJT -->
<Video targetContainer="mpegts" targetACodec="lpcm" targetVCodec="mpeg2video" DAR="4:3" forceInheritance="true">
<Matches container="avi" vCodec="dvvideo" />
</Video>
<!-- transcode audio only for wmv with wmapro -->
<Video targetContainer="asf" targetACodec="ac3" aBitrate="256">
<Matches container="asf" aCodec="wmapro" />
</Video>
<Audio targetContainer="lpcm">
<Matches container="flac" />
<Matches container="wav" />
</Audio>
</Transcoding>

Please find complete log file and profiles.xml attached.

Re: Audio stream deleted when transcoding .avi file

PostPosted: Thu Dec 29, 2022 10:46 pm
by atc98092
The portion of the profile you copied isn't what is being used. Per the log, it's using the "Samsung TV / player (C/D-series)" profile, which extends the Samsung E/F profile. Neither of those profiles use LPCM as the target audio codec, unless you've altered them. those profiles use AC3 (Dolby Digital) as the target audio codec, and should work just fine on your TV.

My first suggestion is to try a different profile. I'd first try the "Samsung TV / player (E/F-series)", since that's what is being used to extend the C/D profile. Per that profile, your AVI file should be transcoded into the MPEG-TS container and using AC3 as the output audio. However, I'm a bit puzzled by your FFMPEG info on the AVI file. I don't recognize dvvideo as a codec. I'm suspicious that the codec is tripping up the transcoding profile. I do see that Zip has included dvvideo as a codec that can be matched, so it's possible that a new line might be necessary in the profile to correctly match your video codec.

Have you tried changing to the Generic profile, and see if the file will play without transcoding? It's worth a shot.

Re: Audio stream deleted when transcoding .avi file

PostPosted: Fri Dec 30, 2022 3:56 pm
by flavius
I've tried without transcoding, but the TV displays the message "unsupported video codec".
Next I've tried Samsung E/F profile, which should transcode the audio to ac3, according to the log file:
2022-12-30T16:28:53,387 DEBUG [VideoDeliveryEngine] Delivering file '03.02.16_08.46.avi' using transcoding (profile: sam_ef > quality: ORIGINAL > Transcoding > [MPEG2TS/MPEG2/AC3] > matcher: 6)

But the ffmpeg command still cancels the audio stream:
2022-12-30T16:28:52,386 DEBUG [ProcessExecutor] Starting F:\Programme\Streaming\Serviio\bin\\..\lib\ffmpeg.exe -threads 0 -i T:\Video_T\Mini-DV-Kassetten\03\02\16\03.02.16_08.46.avi -y -threads 0 -c:v mpeg2video -pix_fmt yuv420p -qscale:v 1 -r 25 -g 15 -an -map 0:0 -sn -f mpegts C:\Windows\TEMP\Serviio\transcoding-temp-affe42765de853a253be3eddeb2b75da.stf

If I remove the options "-an -map 0:0" and execute the ffmpeg command manually, the result file does contain an audio stream.

Do you have any idea why the ffmpeg command is generated with these options?
Find log file and profiles.xml attached.

Re: Audio stream deleted when transcoding .avi file

PostPosted: Fri Dec 30, 2022 6:52 pm
by atc98092
Unfortunately, you've gone past my skill level. Hopefully the developer will see this and be able to offer some other options. The only other suggestion I would have is to try some other profiles. The Roku TV profile might be worth trying, as it transcodes AVI files as well. It uses the applehttp/HLS protocol, which I believe would be supported by your TV as well.

Re: Audio stream deleted when transcoding .avi file

PostPosted: Fri Jan 06, 2023 5:44 pm
by flavius
I've implemented a workaround and installed a wrapper, an exe-file named ffmpeg.exe that is called by serviio instead of the original ffmpeg.exe.
The wrapper scans the command line arguments submitted by serviio and removes the unwanted -an map 0:0 arguments.
Then it calls the original ffmpeg.exe with the remaining command line arguments.

That is not a nice solution but it works for me.