Config file, CustomMencoderOptions, harddup parameter

Developers forum for Univeral Media Server-related development (only for programmers)
Post Reply
ge2001
Posts: 8
Joined: Thu Dec 05, 2013 3:57 am

Config file, CustomMencoderOptions, harddup parameter

Post by ge2001 »

Hi,
writing a config file for my UPNP client i set "CustomMencoderOptions" in the config file. My OS and UMS are up to date.

Using this line everything works fine so far (sometimes AV sync problems), i.e i can watch flv movies:
CustomMencoderOptions = -mc 0 -noskip -vf scale=720:576 harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:acodec=mp2:abitrate=224 -ofps 25

To avoid further AV sync problems i read the MEncoder doc page and i realize that there should be a comma in front of "harddup":
CustomMencoderOptions = -mc 0 -noskip -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:acodec=mp2:abitrate=224 -ofps 25

Adding the comma i'm not able to watch flv movies. The flv video starts and stops without showing the video.
Removing "harddup" completly, the same error (no video).
I'm very confused. Can anybody help me with this issue?
The log files are attached.

Regards
Attachments
ums_dbg_harddup_without_comma.zip
(24.86 KiB) Downloaded 540 times
ums_dbg_harddup_with_comma.zip
(27.73 KiB) Downloaded 529 times
User avatar
DeFlanko
Posts: 724
Joined: Thu Jun 21, 2012 3:43 am
Location: San Pedro, CA
Contact:

Re: Config file, CustomMencoderOptions, harddup parameter

Post by DeFlanko »

From mplayer(1):
> harddup
>
> Only useful with MEncoder. If harddup is used when encoding, it will
> force duplicate frames to be encoded in the output. This uses
> slightly more space, but is necessary for output to MPEG files or if
> you plan to demux and remux the video stream after encoding. Should
> be placed at or near the end of the filter chain unless you have a
> good reason to do otherwise.
7.1.12.1. Improving muxing and A/V sync reliability

You may experience some serious A/V sync problems while trying to mux your video and some audio tracks, where no matter how you adjust the audio delay, you will never get proper sync. That may happen when you use some video filters that will drop or duplicate some frames, like the inverse telecine filters. It is strongly encouraged to append the harddup video filter at the end of the filter chain to avoid this kind of problem.

Without harddup, if MEncoder wants to duplicate a frame, it relies on the muxer to put a mark on the container so that the last frame will be displayed again to maintain sync while writing no actual frame. With harddup, MEncoder will instead just push the last frame displayed again into the filter chain. This means that the encoder receives the exact same frame twice, and compresses it. This will result in a slightly bigger file, but will not cause problems when demuxing or remuxing into other container formats.

You may also have no choice but to use harddup with container formats that are not too tightly linked with MEncoder such as the ones supported through libavformat, which may not support frame duplication at the container level.
so i think then the correct usage is...:

Code: Select all

CustomMencoderOptions = -mc 0 -noskip -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:acodec=mp2:abitrate=224 -ofps 25
i'm wondering if the output fps is 25 is the cause of the issue if its trying to inject frames to keep everything in sync... can you try a different -ofps? maybe 24 instead?
ge2001
Posts: 8
Joined: Thu Dec 05, 2013 3:57 am

Re: Config file, CustomMencoderOptions, harddup parameter

Post by ge2001 »

Hi,
thank you for the answer.
In the meantime i realize all that strang AV sync problems were a result of the poor LAN chip inside my client M740AV (~22 Mbit/s).
So, inside UMS, under Transcode settings i select "keyint=25:vqmax=5:vqmin=2". All (!) the AV sync problems are gone, Yeah ... :-)
Also while resuming, fast forward or fast rewind. In the past sometimes a video stopped without a reason. Everything is fixed now. :-)
This could be a hint for other users with AV sync or simular problems.

My client don't support ac3 audio (only mpa) in the generated mpeg2 file, that was the main trouble for me with UMS.
But now everything works perfect. As a wish, maybe the developers could add another Profile, "TranscodeVideo = MPEGPSMPA", or so ...

Harddup comma issue is realy strange, but everything works fine now, without the comma. Who cares ... :-) :-) :-)
One thing do not work, NTSC videos with 29.97 fps causes audio disturbance. But that is realy a small problem for me in Europe.
25 fps ist the european video standard, but i can try to set it to 24 fps, just for fun.

Again, i'm very happy with UMS; muchas gracias flys to the Developers!
I will update the Siemens Gigaset M740AV Render Thread tomorrow. Because i can upload zip files now :-) i'll include some screenshots of my UMS settings.

Regards
Last edited by ge2001 on Tue Dec 17, 2013 11:24 pm, edited 1 time in total.
User avatar
DeFlanko
Posts: 724
Joined: Thu Jun 21, 2012 3:43 am
Location: San Pedro, CA
Contact:

Re: Config file, CustomMencoderOptions, harddup parameter

Post by DeFlanko »

haha, well whatever works i guess =)
ge2001
Posts: 8
Joined: Thu Dec 05, 2013 3:57 am

Re: Config file, CustomMencoderOptions, harddup parameter

Post by ge2001 »

Hi again,
some minutes ago i found a solution for the (my) NTSC framerate problem.
NTSC videos with 23.976 or 29.970 fps causes audio disturbance transcoding to my PAL device which uses 25 fps.
Inside UMS select Transcode settings Tab and select MEncoder.
Click Expert settings and insert this code in the box:

framerate == 23.976 :: -speed 25025/24000 -ofps 25
framerate == 29.970 :: -speed 25025/30000 -ofps 25

Don't forget to save. Restart UMS and enjoy.

Regards
Snapshot_08.jpg
Snapshot_08.jpg (314.17 KiB) Viewed 10394 times
Post Reply