Project

General

Profile

Codec profile - full frame rate deinterlacing?

Added by John Blumpy over 6 years ago

Hi all,

I'm playing with Tvheadend and would like it to replace my current setup. I am enjoying it so far but I have an issue though: I cannot get Tvheadend to transcode DVB-T/S streams in the way I'd like. I have a Stream Profile using the built-in Codec Profile "webtv-h264" and it seems to work fine for my clients but I want it to perform full deinterlacing using yadif2x and there doesn't seem to be an option for this. The included "deinterlace" option seems to be half-frame-rate deinterlacing (e.g. 50 fields to 25 frames), which isn't good enough for my purposes.

Normally I'd do this by editing the ffmpeg parameters (something like -vf "yadif=1" -r 50) but I can't see a way to do this in Tvheadend. The included "Parameters" option is just for libx264 parameters which doesn't help. I can see in the debug log that Tvheadend is setting some parameters that look similar to ffmpeg parameters (e.g. bit rate, width, height, etc.) but I have no idea how to override any of these.

Is what I want possible? It is bizarre to me that overriding the ffmpeg parameters isn't included as an option when so many other customisation options exist!

OS: Ubuntu Server 16.04 LTS
Version: ubuntu-xenial-unstable (4.3-1292~g9b9ee68)


Replies (33)

RE: Codec profile - full frame rate deinterlacing? - Added by saen acro over 6 years ago

Add some info for OS and TVH version.

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

Sorry, added. I was originally using 4.2-stable but that doesn't have any codec profiles at all so I'm using the latest version.

RE: Codec profile - full frame rate deinterlacing? - Added by saen acro over 6 years ago

Do you try with Parameters: of h264 video codec profile?

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

Yes, I already stated that: the "parameters" box is for libx264 parameters, not ffmpeg parameters. libx264 doesn't do deinterlacing itself.

RE: Codec profile - full frame rate deinterlacing? - Added by saen acro over 6 years ago

Then you must use pipe ffmpeg transcoding, when client can not do de-interlace.

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

OK thanks, are there any guides for how to set that up for Tvheadend? I can see this how-to guide:

https://tvheadend.org/projects/tvheadend/wiki/Custom_MPEG-TS_Input

but I don't understand where to set this up in the GUI?

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

Thanks, I've set up a new MPEG-TS Spawn profile and used an ffmpeg string that works for a local file on the machine. However, I cannot select that new profile in TVHClient (Android app). Any ideas?

RE: Codec profile - full frame rate deinterlacing? - Added by saen acro over 6 years ago

Recreate connection
With app is this?

restart on error (/)
very useful

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

As I said, the app is TVHClient, as listed here:

https://tvheadend.org/projects/tvheadend/wiki/Clients

I tried recreating the connection but it still only sees those 5 profiles.

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

OK I've tried with Dream Player for TVHeadend and although it can see my new profile, no videos play when using it. I've confirmed the ffmpeg command works from the command line so I'm guessing something to do with the pipe or mime type is wrong? The error in the log is:

[ ERROR]:pass: Unable to start pipe 'pipe:///usr/bin/ffmpeg -loglevel fatal -threads 4 -i INPUTLINK -codec:v libx264 -b:v 2904k -vf "yadif=1:-1:1, scale=1280:720" -profile:v baseline -preset:v faster -coder 1 -tune zerolatency -mbd rd -codec:a aac -b:a 96k -ac 2 -strict experimental -async 1 -sn -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts pipe:1' (wrong executable?)

The profile settings are the same as in the screenshot from my previous post. Even if I change the command line to something really basic it produces the same error:

[ ERROR]:pass: Unable to start pipe 'pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 pipe:1' (wrong executable?)

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy over 6 years ago

I've now tried to use the example from https://tvheadend.org/projects/tvheadend/wiki/Custom_MPEG-TS_Input verbatim:

pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 -mbd rd -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1

and it still just says "Unable to start pipe". Running /usr/bin/ffmpeg from the command line as the "hts" user works fine. Removing the "-loglevel fatal" switch doesn't provide any more information either.

Is the pipe feature just broken in 4.3-1292?

RE: Codec profile - full frame rate deinterlacing? - Added by Rotarum Rotarum about 6 years ago

John Blumpy wrote:

I've now tried to use the example from https://tvheadend.org/projects/tvheadend/wiki/Custom_MPEG-TS_Input verbatim:

pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 -mbd rd -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1

and it still just says "Unable to start pipe". Running /usr/bin/ffmpeg from the command line as the "hts" user works fine. Removing the "-loglevel fatal" switch doesn't provide any more information either.

Is the pipe feature just broken in 4.3-1292?

Same here :(

"pass: Unable to start pipe 'pipe:///usr/bin/ffmpeg"

Using latest unstable version 1496

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy about 6 years ago

Rotarum Rotarum wrote:

John Blumpy wrote:

I've now tried to use the example from https://tvheadend.org/projects/tvheadend/wiki/Custom_MPEG-TS_Input verbatim:

pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 -mbd rd -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1

and it still just says "Unable to start pipe". Running /usr/bin/ffmpeg from the command line as the "hts" user works fine. Removing the "-loglevel fatal" switch doesn't provide any more information either.

Is the pipe feature just broken in 4.3-1292?

Same here :(

"pass: Unable to start pipe 'pipe:///usr/bin/ffmpeg"

Using latest unstable version 1496

FYI I figured this out: you have to remove the "pipe://" part. I haven't been able to test if the transcoding works as expected yet though since I can't find a client that supports HTTP streams from Tvheadend.

RE: Codec profile - full frame rate deinterlacing? - Added by Rotarum Rotarum about 6 years ago

OMG i've done it :)

First he was saying:

"spawn: Output #0, mpegts, to 'pipe:0':

spawn: Output file #0 does not contain any stream"

So i have replaced a new input like this:

ffmpeg -i pipe:0

and at the end of the line:

pipe:1

working now :P

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy about 6 years ago

Rotarum Rotarum wrote:

OMG i've done it :)

First he was saying:

"spawn: Output #0, mpegts, to 'pipe:0':

spawn: Output file #0 does not contain any stream"

So i have replaced a new input like this:

ffmpeg -i pipe:0

and at the end of the line:

pipe:1

working now :P

Thanks for this tip! The examples on the wiki page use "INPUTLINK" as the input stream but you're right, it needs to be "pass:0".

I'm now trying to figure out how to choose a particular audio stream to pass to the input...

RE: Codec profile - full frame rate deinterlacing? - Added by Rotarum Rotarum about 6 years ago

Normally like this:

-map 0:0 -map 0:1

First map to pickup video 0:0 and second map for audiostream 0:1 for example

Good luck :)

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy about 6 years ago

Rotarum Rotarum wrote:

Normally like this:

-map 0:0 -map 0:1

First map to pickup video 0:0 and second map for audiostream 0:1 for example

Good luck :)

Yep I'll give that a try. I am not sure if it'll work though because I have a feeling the audio streams for HD channels are in the opposite order compared to SD channels (e.g. SD: 0 = normal, 1 = narration, HD: 0 = narration, 1 = normal).

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy about 6 years ago

John Blumpy wrote:

Rotarum Rotarum wrote:

Normally like this:

-map 0:0 -map 0:1

First map to pickup video 0:0 and second map for audiostream 0:1 for example

Good luck :)

Yep I'll give that a try. I am not sure if it'll work though because I have a feeling the audio streams for HD channels are in the opposite order compared to SD channels (e.g. SD: 0 = normal, 1 = narration, HD: 0 = narration, 1 = normal).

I think I'm slightly misunderstanding how this works. If I use:

-map 0

Then I get both audio streams. This is fine but presumably it's encoding both audio streams? If so, that's a waste of bandwidth on mobile. If I instead add:
-map 0:0 -map 0:1

I just get the narration audio stream. If I use:
-map 0:0 -map 0:2

I get no audio at all. :/

Any ideas?

RE: Codec profile - full frame rate deinterlacing? - Added by John Blumpy about 6 years ago

saen acro wrote:

use ffprobe to analise stream
then
https://trac.ffmpeg.org/wiki/Map
Example 4

Thanks. As I suspected, HD and SD channels use different stream IDs. For audio I need to use stream ID 4 for HD channels and stream ID 2 for SD channels. What's the best way to deal with this?

RE: Codec profile - full frame rate deinterlacing? - Added by saen acro about 6 years ago

Use build-in stream filter in TVH

RE: Codec profile - full frame rate deinterlacing? - Added by Rene Wagler almost 5 years ago

How can i create a spawn profile? I have TVH 4.2.8-36 and i cant find these profiles to select it. I simply want to pre- deinterlace, no transcode

RE: Codec profile - full frame rate deinterlacing? - Added by Rene Wagler almost 5 years ago

How can i create a spawn profile? I have TVH 4.2.8-36 and i cant find these profiles to select it. I simply want to pre- deinterlace, no transcode

(1-25/33)