Page 1 of 1

Problem to transcode pure audio files to LPCM

PostPosted: Mon Jan 13, 2014 7:55 am
by pierrep
Hello

I have a device (Sharp Aquos TV) supporting only LPCM. My music collection is mainly composed of FLAC files. So I had to transcode.
With Serviio 1.2 I had no problem but when upgraded to Serviio 1.4, it's impossible to read the transcoded file on the device.
I had a look at the debug log file and I try to launch manually the same ffmpeg command
  Code:
$ ffmpeg -threads 4 -i InputFile.flac -y -threads 4 -ar 44100 -ac 2 -f s16be OutputFile.flv
ffmpeg version 0.10.9-7:0.10.9-1~saucy1 Copyright (c) 2000-2013 the FFmpeg developers
  Input #0, flac, from 'InputFile.flac':
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
  Output #0, s16be, to 'OutputFile.flv':
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, 2 channels, s16, 1411 kb/s
  Stream mapping:
    Stream #0:0 -> #0:0 (flac -> pcm_s16be)
  size=   71226kB time=00:06:53.46 bitrate=1411.2kbits/s
  video:0kB audio:71226kB global headers:0kB muxing overhead 0.000000%
$ ffmpeg -i OutputFile.flv
OutputFile.flv: Invalid data found when processing input

I have tried with multiple versions of ffmpeg on both Linux/Ubuntu x64 and Windows 7 x86 and with multiple input files (Flac and Wav) with always the same result :(

What has been changed concerning this kind of transcoding between Serviio 1.2 and 1.4?

Pierre

Re: Problem to transcode pure audio files to LPCM

PostPosted: Wed Jan 15, 2014 8:59 am
by pierrep
Hello

I've made some tests: the ffmpeg command launched by Serviio is not valid (as the -f parameter force output file format which is normally auto detected from the file extension of the output file).
Existing command: ffmpeg -threads 4 -i InputFile.flac -y -threads 4 -ar 44100 -ac 2 -f s16be OutputFile.flv

I've tested with the following command: ffmpeg -threads 4 -i InputFile.flac -y -threads 4 -ar 44100 -ac 2 -acodec lpcm_s16be OutputFile.flv.
We have to omit the -f s16be parameter with a FLV output
This new command create a valid file (according to ffmpeg) but it seems it is a Little-Endian PCM file (pcm_16le) instead of the expected Big-Endian (pcm_16be).
When I open it with VLC for example it's not possible to play it correctly. It is OK if I use lpcm_s16le codec but DLNA norm says "Big-Endian LPCM"

Genereted file with -acodec lpcm_s16be
  Code:
$ ffmpeg -i OutputFile.flv
Input #0, flv, from 'OutputFile.flv':
  Metadata:
    encoder         : Lavf55.23.103
  Duration: 00:01:00.00, start: 0.000000, bitrate: 1412 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s

How is it possible to change the ffmpeg command launched by Serviio? (Do we have to wait for a new version or patch?)

Regards
Pierre

Re: Problem to transcode pure audio files to LPCM

PostPosted: Tue Jan 21, 2014 9:50 am
by pierrep
I've made additional tests
The only way I have found to create a valid Big Endian LPCM file is to use: fmpeg -i InputFile.flac -y -threads 4 -ar 44100 -ac 2 -acodec pcm_s16be -f dvd OutputFile.flv
This command create some warnings but create a file which is seen as "PCM / Big Endian" by Mediainfo and is correctly played by VLC on a little endian hardware (PC with Windows 7)

I cannot test the created file with Serviio and my renderer as Serviio do not support pure audio .FLV files, .L16 files or .PCM files
How is it possible to change the ffmpeg command launched by Serviio? (Do we have to wait for a new version or patch?)

Regards
Pierre