Page 1 of 2

How to transcode video audio only?

PostPosted: Sun Jun 03, 2012 11:38 am
by 10one10
Hi there,

I'm trying to configure a profile for my popcorn hours A100 and A210. All I need to do is transcode DTS to AC3 and keep everything the same as the generic profile. Can someone please help me here and show me what I need to do? I've read the tutorials and tried a few things but I just can't get it.

Thanks.

Re: How to transcode video audio only?

PostPosted: Sun Jun 03, 2012 12:18 pm
by 10one10
OK I figured it out. You have to specify a container. Not exactly what I wanted because the popcorn hour can handle all containers. Here is my working profile for anyone interested. This is for playback on a stero TV:

<Profile id="22" name="Popcorn Hour NMT" extendsProfileId="1">
<Detection>
<UPnPSearch>
<ModelName>Popcorn Hour NMT</ModelName>
</UPnPSearch>
</Detection>
<Transcoding>
<Video targetContainer="mpegts" targetACodec="mp3" forceStereo="true">
<Matches container="matroska" />
<Matches container="mpeg" />
<Matches container="mpegts" />
<Matches container="mpegvideo" />
<Matches container="avi" vCodec="h264" />
<Matches container="avi" vCodec="msmpeg4" />
<Matches container="avi" vCodec="wmv2" />
<Matches container="avi" vCodec="dvvideo" />
<Matches container="wtv" />
<Matches container="ogg" />
<Matches container="3gp" />
<Matches container="flv" />
</Video>
</Transcoding>
</Profile>

Re: How to transcode video audio only?

PostPosted: Fri Jun 29, 2012 6:12 pm
by mrpessimist
I too have been trying to figure this out.

I have 20 Divx files that have 44.1kHz sample rate mp3 audio encoding and my PS3 does not like it.

After spending a few hours with the profile.xml trying different combinations of audio transcoding, it looks like I must transcode the video too. Is there anyway to "pass through" the video data and just transcode the audio?

If not, is there a video codec that I can transcode with that is easier on the cpu? I've already successfully transcoded the Divx video to mpeg2 and the audio to AC3, but ffmpeg.exe kills my poor ULV Celeron M processor on my server.

Re: How to transcode video audio only?

PostPosted: Sun Jul 01, 2012 7:48 pm
by zip
you can just remux the video, yes. Use mpegts container and don't provide targetVCodec.

Re: How to transcode video audio only?

PostPosted: Wed Jul 04, 2012 8:29 am
by patters
The reason you have to specify a container is that only very few containers can be live-streamed (i.e. written while that same files is being played). I think that profile can be a lot more specific. Also, the ac3 encoder is much more efficient than the mp3 one, even with 5.1 channels. So, how about:

  Code:
<Profile id="22" name="Popcorn Hour NMT" extendsProfileId="1">
<Detection>
<UPnPSearch>
<ModelName>Popcorn Hour NMT</ModelName>
</UPnPSearch>
</Detection>   
<Transcoding>
<Video targetContainer="mpegts" targetACodec="ac3">
<Matches container=* aCodec="dca" />
</Video>
</Transcoding>
</Profile>


If you want to force two channel audio during transcoding, set that option in the Transcoding tab of the Serviio Console application.

EDIT - actually I think the wildcard matching I used there (container=*) will only be supported in the next version of Serviio (I've been running the betas so I forgot). Shouldn't be long though.

Re: How to transcode video audio only?

PostPosted: Wed Jul 11, 2012 5:31 pm
by mrpessimist
Thank you both for the replies. When I get some time I will modify the profiles.xml and see what happens.

Re: How to transcode video audio only?

PostPosted: Tue Jul 17, 2012 9:32 pm
by mrpessimist
I setup transcoding with mpegts as target container and no targetVCodec specified. When I go to play the file on my ps3, I get a "network error" response. Also, my LG BD player hangs. However, if I go in a specify a targetVCodec again (mpeg2video) everything works fine, except for ffmpeg grilling my Celeron M cpu.

Looks like I have to specify a targetVCodec? If so, is there a codec that I can transcode to that is less taxing on my cpu?

Re: How to transcode video audio only?

PostPosted: Tue Jul 17, 2012 10:48 pm
by zip
you dont have to specify targetVCodec. What is the detailed log when you play the file?

Re: How to transcode video audio only?

PostPosted: Mon Jul 23, 2012 3:57 am
by mrpessimist
My PS3 returns this error:
"Media Server Error: A network error has occurred. (00000000)"

Serviio log file output:

2012-07-22 20:44:25,000 WARN [ProcessExecutor] Process cmd has a return code of 1! This is a possible error.
2012-07-22 20:44:31,140 ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: FFmpeg execution failed
java.io.IOException: FFmpeg execution failed
at org.serviio.delivery.resource.transcode.FileBasedTranscodingDeliveryStrategy.createInputStream(FileBasedTranscodingDeliveryStrategy.java:47)
at org.serviio.delivery.resource.transcode.AbstractTranscodingDeliveryEngine.retrieveTranscodedResource(AbstractTranscodingDeliveryEngine.java:129)
at org.serviio.delivery.resource.AbstractDeliveryEngine.deliver(AbstractDeliveryEngine.java:96)
at org.serviio.delivery.MediaResourceRetrievalStrategy.retrieveResource(MediaResourceRetrievalStrategy.java:121)
at org.serviio.upnp.webserver.ResourceTransportRequestHandler.handleRequest(ResourceTransportRequestHandler.java:116)
at org.serviio.upnp.webserver.AbstractRequestHandler.handle(AbstractRequestHandler.java:54)
at org.apache.http.protocol.HttpService.doService(HttpService.java:293)
at org.serviio.upnp.webserver.ServiioHttpService.doService(ServiioHttpService.java:58)
at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:212)
at org.serviio.upnp.webserver.WebServer$WorkerThread.run(WebServer.java:187)
2012-07-22 20:44:31,171 ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: FFmpeg execution failed
java.io.IOException: FFmpeg execution failed
at org.serviio.delivery.resource.transcode.FileBasedTranscodingDeliveryStrategy.createInputStream(FileBasedTranscodingDeliveryStrategy.java:47)
at org.serviio.delivery.resource.transcode.AbstractTranscodingDeliveryEngine.retrieveTranscodedResource(AbstractTranscodingDeliveryEngine.java:129)
at org.serviio.delivery.resource.AbstractDeliveryEngine.deliver(AbstractDeliveryEngine.java:96)
at org.serviio.delivery.MediaResourceRetrievalStrategy.retrieveResource(MediaResourceRetrievalStrategy.java:121)
at org.serviio.upnp.webserver.ResourceTransportRequestHandler.handleRequest(ResourceTransportRequestHandler.java:116)
at org.serviio.upnp.webserver.AbstractRequestHandler.handle(AbstractRequestHandler.java:54)
at org.apache.http.protocol.HttpService.doService(HttpService.java:293)
at org.serviio.upnp.webserver.ServiioHttpService.doService(ServiioHttpService.java:58)
at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:212)
at org.serviio.upnp.webserver.WebServer$WorkerThread.run(WebServer.java:187)


This is how my profile is setup (specifically the bottom group):
  Code:
<Profile id="4" name="Playstation 3" extendsProfileId="1">
      <Detection>
         <HttpHeaders>
            <X-AV-Client-Info>.*PLAYSTATION 3.*</X-AV-Client-Info>
         </HttpHeaders>   
      </Detection>
      <MediaFormatProfiles>
         <MediaFormatProfile mime-type="video/divx">AVI</MediaFormatProfile>
      </MediaFormatProfiles>
      <Transcoding>
         <!-- Transcode all h264 video with HIGH/MAIN > Level 4.1 on MPEG-TS stream with MPEG2VIDEO and ac3 audio transcoding -->
         <Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
            <Matches container="avi" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="avi" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="matroska" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="matroska" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="mp4" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="mp4" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="mpegts" vCodec="h264" profile="high" levelGreaterThan="4.1" />
                     <Matches container="mpegts" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="avi" vCodec="dvvideo" />
            <Matches container="matroska" vCodec="vp8" />
         </Video>
         <!--
            remux MKV with any video to MPEG2TS and possibly change audio to ac3, also AVI and FLV with H264
         -->
         <Video targetContainer="mpegts" targetACodec="ac3">
            <Matches container="matroska" />
            <Matches container="avi" />
            <Matches container="flv" vCodec="h264" />
            <Matches container="3gp" aCodec="amrnb" />
         </Video>

Re: How to transcode video audio only?

PostPosted: Mon Jul 23, 2012 3:52 pm
by zip
can you enable detailed logging, try it again and find the ffmpeg command that fails? then run it manually and post the error message you'll get

Re: How to transcode video audio only?

PostPosted: Tue Jul 24, 2012 6:01 am
by mrpessimist
Is this what you're looking for? If not, you will have to explain further what "run it manually" means.

2012-07-23 22:26:34,734 DEBUG [FFMPEGWrapper] Invoking FFmpeg to transcode video file: D:\multimedia\Seaworld.avi
2012-07-23 22:26:34,734 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\bin\\..\lib/ffmpeg.exe -i D:\multimedia\Seaworld.avi -y -async 1 -vcodec copy -copyts -acodec ac3 -ab 112k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf
2012-07-23 22:26:36,015 WARN [ProcessExecutor] Process cmd has a return code of 1! This is a possible error.
2012-07-23 22:26:36,031 DEBUG [TranscodingJobListener] Transcoding finished; successful: false
2012-07-23 22:26:42,296 ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: FFmpeg execution failed

Re: How to transcode video audio only?

PostPosted: Tue Jul 24, 2012 3:25 pm
by zip
it's hlf of it. now open a command window and run this comand

  Code:
ffmpeg.exe -i D:\multimedia\Seaworld.avi -y -async 1 -vcodec copy -copyts -acodec ac3 -ab 112k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf


More details here: viewtopic.php?f=5&t=960

Re: How to transcode video audio only?

PostPosted: Mon Jul 30, 2012 5:42 am
by mrpessimist
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Admin>cd c:\program files\serviio\lib

C:\Program Files\Serviio\lib>ffmpeg.exe -i D:\multimedia\Seaworld.
avi -y -async 1 -vcodec copy -copyts -acodec ac3 -ab 112k -ac 2 -map 0:0 -map 0:
1 -sn -f mpegts D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf
ffmpeg version 0.9, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 13 2011 20:46:11 with gcc 4.4.2
configuration: --enable-static --disable-shared --disable-ffplay --disable-ffs
erver --enable-memalign-hack --enable-libmp3lame --enable-librtmp --extra-libs='
-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86 --enable-runtime-cpudetect --enab
le-pthreads --target-os=mingw32 --cross-prefix=i686-mingw32- --pkg-config=pkg-co
nfig
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 42. 0 / 53. 42. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
[mpeg4 @ 003fa020] Invalid and inefficient vfw-avi packed B frames detected

Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/
2733) -> 23.98 (10000000/417083)
Input #0, avi, from 'D:\multimedia\Seaworld.avi':
Metadata:
encoder : AVI-Mux GUI 1.17.7, Aug 8 2006 20:59:17
JUNK :
Duration: 01:56:58.79, start: 0.000000, bitrate: 834 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv
420p, 672x272 [SAR 1:1 DAR 42:17], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16, 112 kb
/s
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 019bda20] channel_layout not specified
[ac3 @ 019bda20] No channel layout specified. The encoder will guess the layout,
but it might be incorrect.
[mpegts @ 003f8020] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every
40 pkts
Output #0, mpegts, to 'D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf':
Metadata:
JUNK :
encoder : Lavf53.24.0
Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 672x272 [SAR 1:1 DAR
42:17], q=2-31, 90k tbn, 23.98 tbc
Stream #0:1: Audio: ac3, 44100 Hz, stereo, flt, 112 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (mp3 -> ac3)
Press [q] to stop, [?] for help
[mpegts @ 003f8020] first pts value must set
av_interleaved_write_frame(): Operation not permitted

C:\Program Files\Serviio\lib>

Re: How to transcode video audio only?

PostPosted: Mon Jul 30, 2012 9:07 am
by zip
ok, thanks. Can you try the same with 1.0?

Re: How to transcode video audio only?

PostPosted: Mon Jul 30, 2012 4:17 pm
by mrpessimist
zip wrote:ok, thanks. Can you try the same with 1.0?


Do you mean Serviio 1.0? or FFmpeg 1.0?

Re: How to transcode video audio only?

PostPosted: Mon Jul 30, 2012 4:28 pm
by zip
Serviio

Re: How to transcode video audio only?

PostPosted: Wed Aug 01, 2012 3:36 am
by mrpessimist
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Admin>cd c:\program files\serviio\lib

C:\Program Files\Serviio\lib>ffmpeg.exe -i D:\multimedia\Seaworld.
avi -y -async 1 -vcodec copy -copyts -acodec ac3 -ab 112k -ac 2 -map 0:0 -map 0:
1 -sn -f mpegts D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf
ffmpeg version N-42368-gbf53863 Copyright (c) 2000-2012 the FFmpeg developers
built on Jul 10 2012 03:40:45 with gcc 4.6.3
configuration: --enable-static --disable-shared --disable-ffplay --disable-ffs
erver --enable-memalign-hack --enable-libmp3lame --enable-librtmp --extra-libs='
-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86 --enable-runtime-cpudetect --enab
le-pthreads --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pk
g-config
libavutil 51. 64.100 / 51. 64.100
libavcodec 54. 33.100 / 54. 33.100
libavformat 54. 15.102 / 54. 15.102
libavdevice 54. 1.100 / 54. 1.100
libavfilter 3. 1.100 / 3. 1.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[avi @ 003FD280] non-interleaved AVI
[mpeg4 @ 01908340] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'D:\multimedia\Seaworld.avi':
Metadata:
encoder : AVI-Mux GUI 1.17.7, Aug 8 2006 20:59:17
JUNK :
Duration: 01:56:58.79, start: 0.000000, bitrate: 834 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv
420p, 672x272 [SAR 1:1 DAR 42:17], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16, 112 kb
/s
[graph 0 input from stream 0:1 @ 01925120] tb:1/44100 samplefmt:s16 samplerate:4
4100 chlayout:0x3
-async is forwarded to lavfi similarly to -af aresample=min_comp=0.001:min_hard_
comp=0.100000.
[graph 0 aresample for input stream 0:1 @ 01925440] chl:stereo fmt:s16 r:44100Hz
-> chl:stereo fmt:flt r:44100Hz
[mpegts @ 01916020] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every
40 pkts
Output #0, mpegts, to 'D:\Temp\Serviio\transcoding-temp-19884-MPEG2TS.stf':
Metadata:
JUNK :
encoder : Lavf54.15.102
Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 672x272 [SAR 1:1 DAR
42:17], q=2-31, 90k tbn, 23.98 tbc
Stream #0:1: Audio: ac3, 44100 Hz, stereo, flt, 112 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (mp3 -> ac3)
Press [q] to stop, [?] for help
[mpegts @ 01916020] first pts value must set
av_interleaved_write_frame(): Invalid data found when processing input

C:\Program Files\Serviio\lib>

Re: How to transcode video audio only?

PostPosted: Wed Aug 01, 2012 1:32 pm
by zip
I meant - try to play the file in Serviio 1.0 - is that still failing? If yes, grab the new ffmpeg command line and try to run that against the FFmpeg from 1.0

Re: How to transcode video audio only?

PostPosted: Fri Aug 03, 2012 6:42 am
by mrpessimist
When trying to play file PS3 returns error "This file type is not supported"

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Admin>cd c:\program files\serviio\lib

C:\Program Files\Serviio\lib>ffmpeg.exe -fflags +genpts -i D:\Multimedia\Seaworl
d.avi -y -copyts -c:v copy -c:a ac3 -b:a 112k -ac 2 -map 0:0 -map 0:1 -sn -f mpe
gts D:\Temp\Serviio\transcoding-temp-19677-4-ORIGINAL.stf
ffmpeg version N-42368-gbf53863 Copyright (c) 2000-2012 the FFmpeg developers
built on Jul 10 2012 03:40:45 with gcc 4.6.3
configuration: --enable-static --disable-shared --disable-ffplay --disable-ffs
erver --enable-memalign-hack --enable-libmp3lame --enable-librtmp --extra-libs='
-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86 --enable-runtime-cpudetect --enab
le-pthreads --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pk
g-config
libavutil 51. 64.100 / 51. 64.100
libavcodec 54. 33.100 / 54. 33.100
libavformat 54. 15.102 / 54. 15.102
libavdevice 54. 1.100 / 54. 1.100
libavfilter 3. 1.100 / 3. 1.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[avi @ 003FD320] non-interleaved AVI
[mpeg4 @ 01908380] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'D:\Multimedia\Seaworld.avi':
Metadata:
encoder : AVI-Mux GUI 1.17.7, Aug 8 2006 20:59:17
JUNK :
Duration: 01:56:58.79, start: 0.000000, bitrate: 834 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (DX50 / 0x30355844), yuv
420p, 672x272 [SAR 1:1 DAR 42:17], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16, 112 kb
/s
[graph 0 input from stream 0:1 @ 003F9EA0] tb:1/44100 samplefmt:s16 samplerate:4
4100 chlayout:0x3
[auto-inserted resampler 0 @ 01907320] chl:stereo fmt:s16 r:44100Hz -> chl:stere
o fmt:flt r:44100Hz
[mpegts @ 01916020] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every
40 pkts
Output #0, mpegts, to 'D:\Temp\Serviio\transcoding-temp-19677-4-ORIGINAL.stf':
Metadata:
JUNK :
encoder : Lavf54.15.102
Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 672x272 [SAR 1:1 DAR
42:17], q=2-31, 90k tbn, 23.98 tbc
Stream #0:1: Audio: ac3, 44100 Hz, stereo, flt, 112 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (mp3 -> ac3)
Press [q] to stop, [?] for help
frame= 186 fps=0.0 q=-1.0 size= 410kB time=00:00:07.75 bitrate= 433.3kbits/
frame= 358 fps=0.0 q=-1.0 size= 780kB time=00:00:14.90 bitrate= 428.8kbits/
frame= 536 fps=357 q=-1.0 size= 1144kB time=00:00:22.35 bitrate= 419.3kbits/
frame= 714 fps=357 q=-1.0 size= 1507kB time=00:00:29.73 bitrate= 415.3kbits/
frame= 895 fps=358 q=-1.0 size= 1888kB time=00:00:37.29 bitrate= 414.7kbits/
frame= 1084 fps=361 q=-1.0 size= 2167kB time=00:00:45.20 bitrate= 392.7kbits/
frame= 1272 fps=363 q=-1.0 size= 2453kB time=00:00:53.00 bitrate= 379.2kbits/
frame= 1463 fps=366 q=-1.0 size= 2733kB time=00:01:01.01 bitrate= 366.9kbits/
frame= 1646 fps=366 q=-1.0 size= 3138kB time=00:01:08.64 bitrate= 374.5kbits/
frame= 1830 fps=366 q=-1.0 size= 3561kB time=00:01:16.27 bitrate= 382.5kbits/
frame= 1996 fps=363 q=-1.0 Lsize= 4093kB time=00:01:23.24 bitrate= 402.8kbits
/s


--And then it continues to process each frame for the duration of the video file.


video:2391kB audio:1139kB subtitle:0 global headers:0kB muxing overhead 15.96015
6%

C:\Program Files\Serviio\lib>

Re: How to transcode video audio only?

PostPosted: Fri Aug 03, 2012 3:56 pm
by zip
Ok, that's ok then. It might be due to the video stream being dodgy ([mpeg4 @ 01908380] Invalid and inefficient vfw-avi packed B frames detected), therefore you'd have to transcode the video as well