Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
On using libav to satisfy virtual/ffmpeg
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Sun Feb 09, 2014 12:06 am    Post subject: On using libav to satisfy virtual/ffmpeg Reply with quote

I wanted to try LibAV after I read a blog post claiming it's more stable than media-video/ffmpeg. My experience does not support that. There are two major problems here: packages that depend on libpostproc assume it is installed by virtual/ffmpeg, and =media-video/libav-9.10 has a buggy AC3 decoder.

In media-video/ffmpeg, libpostproc.so is included, but in libav it's a separate ebuild. Anything depending on virtual/ffmpeg for libpostproc will fail its configure stage on a LibAV system unless media-libs/libpostproc is also installed. I filed a bug for Cinelerra regarding this dependency issue, but when I ran into the same problem with MPlayer I had installed via a binpkg I had already decided to revert to media-video/ffmpeg; I don't want to take the time to rebuild it from scratch to do a proper test. In any case, the workaround is merely to manually emerge media-libs/libpostproc, and then file a bug on the affected package.

The buggy AC3 decoder may be contained to the unstable =media-video/libav-9.10 ebuild, but it works fine in =media-video/ffmpeg-1.2.5, so that's all that matters to me. The LibAV changelog says some AC3 work was done for 9.9, but not afterwards, so I'll assume the problem goes back to at least 9.9 and affects the current 9.11 as well. The stable =media-video/libav-8.8 ebuild may be unaffected, but again I'm not interested in putting more time into it.

The problem manifests itself as popping and other occasional audio glitches in the output stream. While decoding (with mencoder in my case), the following is printed to the console:
Code:
[ac3 @ 0xb6ac57a0]exponent out-of-range
[ac3 @ 0xb6ac57a0]error decoding the audio block

If the urge strikes me, I'll file a bug with the LibAV project. But I'm pretty flaky about that, so don't count on it.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Feb 09, 2014 2:45 pm    Post subject: Reply with quote

Quote:
I wanted to try LibAV after I read a blog post claiming it's more stable than media-video/ffmpeg. My experience does not support that.

There's a small detail you might not have known: lu_zero is one of the ex-ffmpeg developers who originally instigated the hostile libav fork. You may want to re-read that post with that bias in mind, and ask yourself if it's really trustworthy information or just part of their greater smear campaign.

Having said that, my own experience with libav is limited to seeing it mentioned frequently in a security context.
Back to top
View user's profile Send private message
GFCCAE6xF
Apprentice
Apprentice


Joined: 06 Aug 2012
Posts: 295

PostPosted: Sun Feb 09, 2014 3:19 pm    Post subject: Reply with quote

Along with with what Ant said above, I'd like to add that is may be worth having a read through this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729203
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Sun Feb 09, 2014 3:26 pm    Post subject: Reply with quote

@Ant.P +
but this last sentence
Quote:
, and ask yourself if it's really trustworthy information or just part of their greater smear campaign.

Why the hell every now and then initiation a war of something generally is the best opensource can provide:
fork and thereby providing choice ! (Though I myself am using the masked ffmpeg )
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Sun Feb 09, 2014 6:20 pm    Post subject: Reply with quote

ulenrich wrote:
(Though I myself am using the masked ffmpeg )


You mean =media-video/ffmpeg-2.1.3? I'm considering unmasking that... Any problems?

Quote:
There's a small detail you might not have known: lu_zero is one of the ex-ffmpeg developers who originally instigated the hostile libav fork. You may want to re-read that post with that bias in mind, and ask yourself if it's really trustworthy information or just part of their greater smear campaign.


Yeah, that was stated in the blog post. I just tried libav to make up my own mind.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Sun Feb 09, 2014 7:16 pm    Post subject: Reply with quote

dobbs wrote:
ulenrich wrote:
(Though I myself am using the masked ffmpeg )

You mean =media-video/ffmpeg-2.1.3? I'm considering unmasking that... Any problems?
Not something I know, but I don't do much with:
Code:
# emerge -1 -p  media-video/ffmpeg vlc handbrake

These are the packages that would be merged, in order:

Calculating dependencies  .... done!
[ebuild   R   #] media-video/ffmpeg-2.1.3:0/52.55.55  USE="-3dnow -3dnowext X aac aacplus -alsa (-altivec) amr -amrenc (-armv5te) (-armv6) (-armv6t2) (-armvfp) -avx -avx2 -bindist -bluray bzip2 cdio -celt -cpudetection -debug -doc encode examples faac fdk -flite -fma4 fontconfig -frei0r -gme -gnutls gsm hardcoded-tables iconv -iec61883 -ieee1394 -jack -jpeg2k -ladspa libass -libcaca libsoxr -libv4l (-mips32r2) (-mipsdspr1) (-mipsdspr2) (-mipsfpu) mmx mmxext -modplug mp3 (-neon) network -openal openssl opus -oss -pic pulseaudio -quvi rtmp schroedinger sdl speex sse sse2 -sse3 -sse4 -sse4_2 ssh ssse3 -static-libs {-test} theora threads truetype twolame -v4l -vaapi vdpau (-vis) vorbis vpx wavpack x264 xvid zlib -zvbi" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart trasher" 0 kB
[ebuild   R    ] media-video/handbrake-0.9.9  USE="fdk ffmpeg gstreamer gtk" 0 kB
[ebuild   R   *] media-video/vlc-2.1.9999:0/5-7  USE="X a52 aalib -alsa (-altivec) -atmo (-audioqueue) -avahi avcodec avformat -bidi -bluray cdda -cddb -chromaprint dbus -dc1394 -debug dirac -directfb (-directx) dts dvb dvbpsi dvd (-dxva2) egl encode faad fdk ffmpeg flac fluidsynth fontconfig gcrypt -gme -gnome -gnutls -growl -httpd -ieee1394 (-ios-vout) -jack kate kde libass -libcaca -libnotify libsamplerate -libtar libtiger -linsys -lirc -live -lua (-macosx) (-macosx-audio) (-macosx-dialog-provider) (-macosx-eyetv) (-macosx-qtkit) (-macosx-quartztext) (-macosx-vout) matroska (-media-library) mmx -modplug mp3 mpeg mtp musepack -ncurses (-neon) ogg -omxil opencv opengl -optimisememory opus png postproc -projectm pulseaudio qt4 (-qt5) -rdp rtsp -run-as-root -samba schroedinger sdl -sdl-image -sftp -shout -sid -skins speex sse svg swscale taglib {-test} theora -tremor truetype twolame -udev -upnp v4l -vaapi -vcdx vdpau -vlm vorbis wma-fixed x264 xcb xml xv -zvbi" 0 kB

Total: 3 packages (3 reinstalls), Size of downloads: 0 kB
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Feb 10, 2014 9:39 am    Post subject: Reply with quote

The # indicates that it is masked; indeed, for one to be able to use Handbrake the masked version of media-video/ffmpeg is needed (or an unmasked version of libav) as the new major release has (or had) some packages break:

Code:
# Alexis Ballier <aballier@gentoo.org> (20 Jul 2013)
# New major release and lots of packages fail to build.
# Tracker bug is: https://bugs.gentoo.org/show_bug.cgi?id=476490
>=media-video/ffmpeg-2.0


Handbrake's upstream has already adapted their code to use this newer version; the way forward would be adapt other packages to also work with this newer version, as it would be painful to undo the migrations that upstream did to support earlier versions (well, you could do inverse patches; but it's a recipe for disastrous bugs, as well as for a drop in support because of undoing upstream's work). As a side note I should mention that I still use media-video/ffmpeg till this very day as I haven't found a considerable reason to switch to libav so far; in fact, I don't even test these packages with libav (but there are however other maintainers on both packages listed that do). It's also good to see that the newer vlc with the newer ffmpeg works well for you; I think vlc tries to support both branches from what I remember, but it has been a while...

dobbs wrote:
The buggy AC3 decoder may be contained to the unstable =media-video/libav-9.10 ebuild, but it works fine in =media-video/ffmpeg-1.2.5, so that's all that matters to me.


The difference here lies that that is a quite new libav version compared to a quite old ffmpeg version, you might experience the same or a similar bug with the newest ffmpeg due to incompatibilities; but looking further into this, it appears that at least the incompatible compilation bug has already been fixed as per https://bugs.gentoo.org/show_bug.cgi?id=476502 in version 1.2_pre20130729 (though that doesn't imply other playback bugs might pop up). If you want, you can try for experimentation purposes; on the other hand, if you're not in for the fun I'd suggest to not break what still works. :)
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Mon Feb 10, 2014 12:04 pm    Post subject: Reply with quote

TomWij wrote:
I think vlc tries to support both branches from what I remember, but it has been a while..
!?
after vlc-2.1.3 release on the way to vlc-2.1.4 I just saw at:
http://git.videolan.org/?p=vlc/vlc-2.1.git;a=commit;h=38820b3cb1dbb7f2455f59416ab4ac2da199ec85
Quote:
vda: use the ffmpeg api to avoid memleaks.

This will not compile with libav. Libav needs to be fixed before we can
support it again here.
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Feb 10, 2014 12:47 pm    Post subject: Reply with quote

(OT: Thank you very much for mentioning that, I'll see what ends up in the release; if it's not fixed by then, I'll change the virtual/ffmpeg into media-video/ffmpeg.)
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Fri Feb 14, 2014 3:06 am    Post subject: Reply with quote

TomWij wrote:
dobbs wrote:
The buggy AC3 decoder may be contained to the unstable =media-video/libav-9.10 ebuild, but it works fine in =media-video/ffmpeg-1.2.5, so that's all that matters to me.


The difference here lies that that is a quite new libav version compared to a quite old ffmpeg version, you might experience the same or a similar bug with the newest ffmpeg due to incompatibilities; but looking further into this, it appears that at least the incompatible compilation bug has already been fixed as per https://bugs.gentoo.org/show_bug.cgi?id=476502 in version 1.2_pre20130729 (though that doesn't imply other playback bugs might pop up). If you want, you can try for experimentation purposes; on the other hand, if you're not in for the fun I'd suggest to not break what still works. :)


I thought ffmpeg 1.2.5 was quite old as well (Macports has been installing 2.x on my Mac for ages), but the ffmpeg download page says ffmpeg 1.2.5 was released on 2014-01-16. Looks like they're still maintaining the 1.x branch.

Decided to unmask =media-video/ffmpeg-2.1.3 today on a test system. We'll see if the AC3 decoder suffers the same issue, but currently =media-video/mplayer-1.1.1-r1 failed to compile with that version. Might just be my build setup though, looking into it.

edit
Oh, that's what you meant about a compilation bug. :P

Update
Good news, everybody! =media-video/ffmpeg-2.1.3 does not exhibit the AC3 bug. Now I can play with the fieldmatch filter.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 4:16 am    Post subject: Re: On using libav to satisfy virtual/ffmpeg Reply with quote

dobbs wrote:
The problem manifests itself as popping and other occasional audio glitches in the output stream. While decoding (with mencoder in my case), the following is printed to the console:
Code:
[ac3 @ 0xb6ac57a0]exponent out-of-range
[ac3 @ 0xb6ac57a0]error decoding the audio block

If the urge strikes me, I'll file a bug with the LibAV project. But I'm pretty flaky about that, so don't count on it.


What are you using mencoder for? I'm curious now what task you're trying to do.
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Mon Feb 17, 2014 5:03 am    Post subject: Reply with quote

It's one of my pet projects. I like to see how well I can remove problems from video files. And I really hate interlacing.

In this case I've been trying to recover progressive frames from various 23.97FPS DVDs I own that for some reason contain frequent stretches of 29.97FPS interlaced NTSC content (3:2 pulldown), and then encode them for my mobile devices or an on-demand streaming server. So far, nothing works adequately. Mencoder seems more reliable in reconstructing the progressive frames, but utterly fails to produce files playable on anything but VLC. ffmpeg produces compatible files, but doesn't properly reconstruct the progressive frames right at all (drops the wrong fields, interlacing is obvious), and usually destroys A/V sync. A couple years ago I had a nice script that filtered and encoded with Mencoder, and then re-packed the MP4 with ffmpeg to set whatever fields were needed for compatibility... unfortunately it worked for maybe two months before a version upgrade completely broke everything.

I half suspect the interlaced fields in these MPEG2 streams aren't actually encoded multiple times, but rather duplicated bit-for-bit in the stream. Do you know of existing software to inspect MPEG PES packets on that level?
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 6:08 am    Post subject: Reply with quote

dobbs wrote:
It's one of my pet projects. I like to see how well I can remove problems from video files. And I really hate interlacing.

In this case I've been trying to recover progressive frames from various 23.97FPS DVDs I own that for some reason contain frequent stretches of 29.97FPS interlaced NTSC content (3:2 pulldown), and then encode them for my mobile devices or an on-demand streaming server. So far, nothing works adequately. Mencoder seems more reliable in reconstructing the progressive frames, but utterly fails to produce files playable on anything but VLC. ffmpeg produces compatible files, but doesn't properly reconstruct the progressive frames right at all (drops the wrong fields, interlacing is obvious), and usually destroys A/V sync. A couple years ago I had a nice script that filtered and encoded with Mencoder, and then re-packed the MP4 with ffmpeg to set whatever fields were needed for compatibility... unfortunately it worked for maybe two months before a version upgrade completely broke everything.


Oh, geez, I have dealt with the same problem for years ... you're seriously describing every problem I ran into. Variable framerate on DVDs, especially TV shows is a pain.

You know what works 100% of the time? Handbrake. I ignored it for the longest time, but now that I do use it, it does perfect detelecing / deinterlacing / you name it gloriously.

If you haven't tried it, give it a whirl.

Also, I totally wanna compare notes sometime on what you've come up with. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 6:09 am    Post subject: Reply with quote

Forgot to add, HandBrake is in portage, has both a GUI app and a CLI app (HandBrakeCLI). If you need help scripting with it, I can help out there as well.
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Mon Feb 17, 2014 5:08 pm    Post subject: Reply with quote

Ah, good old Handbrake... I haven't seriously used that since the BeOS days. I did pilfer its device profiles once. Didn't consider it because I don't use GUIs on most of my systems, didn't know they had a CLI interface. Will try that. Doesn't Handbrake use ffmpeg or libav?

Most of my notes are scattered across at least eight systems, and I'm not entirely sure all of those are still alive. Feel free to look at my script below though. I created it mostly as a 2-pass batch processing script back in 2007, back when I was working with my PSP. It's gone through many, many revisions. Hope springs eternal. :) Mostly I just change the x264opts variable, but at some point it did hook-in to those Handbrake profiles, and it originally used Mencoder's pullup filter to remove the telecine. Sadly, that version fell victim to my organization skills. Hmm, I should dig up my old aspect ratio calculator spreadsheet and automate the cropping/scaling a little more...

The source material currently giving me trouble is The Simpsons season 8 DVDs. Specifically, this year's Superbowl prompted renewed interest in the ending of the second episode, "You Only Move Twice". It rather topical for an episode that's old enough to drive. :P

Code:
#!/bin/bash

# dobbs' batch encode script
# 2014.2.13 13:28 PST

#
# Begin user-definable encoding parameters
#

# Source Cropping
# minor speed reduction when horizontal crops aren't a multiple of 16
declare CropX="6"   # pixels to trim from left
declare CropY="4"   # pixels to trim from top
declare CropWidth="708"   # source frame width after cropping
declare CropHeight="472"   # source frame height after cropping

# Output frame format
#   16x9:   480x272 (1.76:1) ->  510 macroblocks
#    4x3:   432x320 (1.35:1) ->  540 macroblocks
#    4x3:   416x320  (1.3:1) ->  520 macroblocks
#   16x9:   688x384 (1.79:1) -> 1032 macroblocks
#    4x3:   512x384 (1.33:1) ->  768 macroblocks
#   16x9:   848x480 (1.77:1) -> 1590 macroblocks
#    4x3:   640x480 (1.33:1) -> 1200 macroblocks
declare VidWidth="512"   # final video frame dimensions (multiple of 16)
declare VidHeight="384"   # final video frame dimensions (multiple of 16)
declare FrameRate="24000/1001"   # valid: 12000/1001 15000/1001 24000/1001 30000/1001

# Bitrates (combined audio+video):
#    430kbps -> (5)44m = <700MB   220m/CD
#    540kbps -> (4)44m = <700MB   176m/CD
#    720kbps -> (3)44m = <700MB   132m/CD
#   1080kbps -> (2)44m = <700MB    88m/CD
declare VidRate="500"   # video bitrate
declare AudRate="96"   # audio bitrate

declare x264tuning="animation"
declare x264opts="bframes=2:ref=3:mixed_refs:b_pyramid=none:vbv_maxrate=4000:vbv_bufsize=4000"

#
# End of user-definable area.
# Don't edit below this line unless you know what you are doing!
#

# determine $tmpDir
declare tmpNum=0
declare tmpDir=".pspEnc_"
while [[ -a ${tmpDir}$tmpNum ]]; do (( $((tmpNum++)) )); done
echo Creating working directory ${tmpDir}$tmpNum
mkdir ${tmpDir}$tmpNum
pushd ${tmpDir}$tmpNum

# encode each parameter
declare curParam=0
while (( $curParam < $# ))
do

((curParam++))

#ffmpeg -i "../${!curParam}" -t 30 -an                                    -vf fieldmatch,decimate,crop=${CropWidth}:${CropHeight}:${CropX}:${CropY} -s ${VidWidth}x${VidHeight} -aspect ${VidWidth}:${VidHeight} -b:v ${VidRate}k -bt:v ${VidRate}k -vcodec libx264 -profile:v high -preset:v medium -tune:v ${x264tuning} -x264opts "${x264opts}" -pass:v 1 -f mp4 -level 41 -y /dev/null && \
#ffmpeg -i "../${!curParam}" -t 30 -ac 2 -acodec libfaac -b:a ${AudRate}k -vf fieldmatch,decimate,crop=${CropWidth}:${CropHeight}:${CropX}:${CropY}: -s ${VidWidth}x${VidHeight} -aspect ${VidWidth}:${VidHeight} -b:v ${VidRate}k -bt:v ${VidRate}k -vcodec libx264 -profile:v high -preset:v slower -tune:v ${x264tuning} -x264opts "${x264opts}" -pass:v 2 -f mp4 -level 41    "../${!curParam}.mp4"

mencoder ../"${!curParam}" -nosound                                              -vf filmdint,crop=${CropWidth}:${CropHeight}:${CropX}:${CropY},scale=${VidWidth}:${VidHeight} -ofps ${FrameRate} -ovc x264 -x264encopts pass=1:bitrate="${VidRate}":profile=high:preset=medium:tune=${x264tuning}:${x264opts}                                            -o /dev/null && \
mencoder ../"${!curParam}" -oac faac -faacopts br=${AudRate}:raw:mpeg=4:object=2 -vf filmdint,crop=${CropWidth}:${CropHeight}:${CropX}:${CropY},scale=${VidWidth}:${VidHeight} -ofps ${FrameRate} -ovc x264 -x264encopts pass=2:bitrate="${VidRate}":profile=high:preset=slower:tune=${x264tuning}:${x264opts}:level_idc=41 -of lavf -lavfopts format=mp4 -o "../${!curParam}.mp4"
#ffmpeg -i "${!curParam}.mp4" -i "../${!curParam}" -vcodec copy -acodec libfaac -ab $AudRate -map 0.0 -map 1.1 -level 30 -f psp "../${!curParam}.mp4"


#echo $curParam\/$# \: ${!curParam}

done

# clean up
echo Cleaning up...
popd
rm -r ${tmpDir}$tmpNum
#echo Processed $curParam of $# files.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 5:14 pm    Post subject: Reply with quote

dobbs wrote:
Ah, good old Handbrake... I haven't seriously used that since the BeOS days. I did pilfer its device profiles once. Didn't consider it because I don't use GUIs on most of my systems, didn't know they had a CLI interface. Will try that. Doesn't Handbrake use ffmpeg or libav?


HandBrake uses ffmpeg .. they bundle it internally, IIRC, but our ebuild might just pull it in. I haven't looked.

dobbs wrote:
Most of my notes are scattered across at least eight systems, and I'm not entirely sure all of those are still alive. Feel free to look at my script below though. I created it mostly as a 2-pass batch processing script back in 2007, back when I was working with my PSP. It's gone through many, many revisions. Hope springs eternal. :) Mostly I just change the x264opts variable, but at some point it did hook-in to those Handbrake profiles, and it originally used Mencoder's pullup filter to remove the telecine. Sadly, that version fell victim to my organization skills. Hmm, I should dig up my old aspect ratio calculator spreadsheet and automate the cropping/scaling a little more...


Yah, give Handbrake a try, it does an excellent job on detelecine. You can pass custom x264 opts to it as well. :)

Also, script looks good. How is mencoder holding up these days? Still working okay? I haven't used it in a good while, heard that it has started getting some development love lately, but that could be old news too. It's been at least a year.
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 5:15 pm    Post subject: Reply with quote

Oh, also, if you're looking for details on HandBrake x264 settings, here's something I threw together ... http://dev.beandog.org/handbrake_preset_reference.html
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Nicias
Guru
Guru


Joined: 06 Dec 2005
Posts: 446

PostPosted: Mon Feb 17, 2014 5:34 pm    Post subject: Reply with quote

I've been struggling with this too. Mixed frame rate video combined with telecine. My main headache has been Babylon5 DVDs

I have been mostly working with ffmpeg.

In my experience, the pullup filter works great on this material. There is a problem however. When pullup hits telecined material it produces judder. (It throws out duplicate fields) So if the original started with frames ABCD, then telecine will produce fields AaBbBcCdDd. Then pullup produces ABCD_ with a gap where the next frame is. So if frames Aa Bb Bc Cd Dd Ee .. came at times 1, 2, 3, 4, 5, 6, ... then the new frames ABCD_E will come at 1,2,3,4, 6. This judder is visible and distracting.

To fix the problem I coded a new filter for ffmpeg. The dejudder filter will remove most of this.

Thus if you have mixed progressive/telecined video, "-vf pullup,dejudder" will produce variable frame rate smooth (non-juddered) progressive video. Handbrake does a good job too, but I don't know what it is doing.

the dejudder filter is in the git version of ffmpeg.
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Mon Feb 17, 2014 5:54 pm    Post subject: Reply with quote

I've always followed pullup with softskip (and specified 24 FPS) as advised. I thought that was supposed to fix the frame timing...?

edit
Oh right, the pullup filter I reference was the Mencoder implementation, no ffmpeg. Sounds like you added a missing piece to the ffmpeg version.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 6:09 pm    Post subject: Reply with quote

Nicias wrote:
I've been struggling with this too. Mixed frame rate video combined with telecine. My main headache has been Babylon5 DVDs


Heh, I have what I affectionately call "The Star Trek Test" -- where I take my ST:TNG DVDs and see if I can get them encoded properly, and if that works, everything else will, since they have interlacing, variable framerate, high movement, etc., etc.

Nicias wrote:
I have been mostly working with ffmpeg.

In my experience, the pullup filter works great on this material. There is a problem however. When pullup hits telecined material it produces judder. (It throws out duplicate fields) So if the original started with frames ABCD, then telecine will produce fields AaBbBcCdDd. Then pullup produces ABCD_ with a gap where the next frame is. So if frames Aa Bb Bc Cd Dd Ee .. came at times 1, 2, 3, 4, 5, 6, ... then the new frames ABCD_E will come at 1,2,3,4, 6. This judder is visible and distracting.

To fix the problem I coded a new filter for ffmpeg. The dejudder filter will remove most of this.

Thus if you have mixed progressive/telecined video, "-vf pullup,dejudder" will produce variable frame rate smooth (non-juddered) progressive video. Handbrake does a good job too, but I don't know what it is doing.

the dejudder filter is in the git version of ffmpeg.


Wow, writing your own filter ... that is impressive. I'll have to check it out. It has definitely been the missing piece in ffmpeg. It also always surprises me how issues like that have been around in DVDs for *years* -- especially TV shows on DVDs -- and nobody really talks about it much.

Anyway. Cool. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Nicias
Guru
Guru


Joined: 06 Dec 2005
Posts: 446

PostPosted: Mon Feb 17, 2014 6:17 pm    Post subject: Reply with quote

Thanks,

I've noticed that the problem is mostly actually in sci-fi shows. For example, old tv shows with no CGI shots are fine. For instance M*A*S*H is all 30fps progressive. Some old movies are labeled wrong. Willy Wonka and the Chocolate Factory (with Gene Wilder) is 24 fps but claims to be 30.

Writing my own filter wasn't that hard. I don't mess with the frames at all, just their timing. I do math for a living, so the math part wasn't that hard. It took a while to figure the rest out. I figure, I use enough FOSS that I should give back now and then. Getting it added to the project was harder than writing the filter. Maybe I should say writing it well was harder than writing it poorly :)
Back to top
View user's profile Send private message
dobbs
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 105
Location: Wenatchee, WA

PostPosted: Mon Feb 17, 2014 6:27 pm    Post subject: Reply with quote

beandog wrote:
How is mencoder holding up these days? Still working okay? I haven't used it in a good while, heard that it has started getting some development love lately, but that could be old news too. It's been at least a year.

I'm not keeping tabs on it that closely, but development seems active. Even if not, it works as well as ever. Still doesn't produce files usable on my iPhone. I likely need to revert to encoding video and audio separately and then remuxing with ffmpeg. Though if HandbrakeCLI is as awesome as you say, I would rather use that.

beandog wrote:
Heh, I have what I affectionately call "The Star Trek Test" -- where I take my ST:TNG DVDs and see if I can get them encoded properly, and if that works, everything else will, since they have interlacing, variable framerate, high movement, etc., etc.

Heh, I basically do the same thing with The Simpsons intro. Huh, I expected TNG to be a pure NTSC process, so interlacing would be intrinsic. Did they use actual film? Maybe I'm overestimating DV's role in history.

beandog wrote:
It also always surprises me how issues like that have been around in DVDs for *years* -- especially TV shows on DVDs -- and nobody really talks about it much.

There's a bit hidden in Mplayer's docs about it, and maybe some threads on doom9. Hard to find much else, yeah. I just wish I understood the motives behind the encoding.

Nicias wrote:
Writing my own filter wasn't that hard. I don't mess with the frames at all, just their timing. I do math for a living, so the math part wasn't that hard. It took a while to figure the rest out. I figure, I use enough FOSS that I should give back now and then. Getting it added to the project was harder than writing the filter. Maybe I should say writing it well was harder than writing it poorly :)

lol, that last bit is practically a mantra in the software dev world. :) Thanks for contributing though. I may look into writing a filter once I get up enough nerve to publish my ZNC plugin.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 6:27 pm    Post subject: Reply with quote

Nicias wrote:
I've noticed that the problem is mostly actually in sci-fi shows. For example, old tv shows with no CGI shots are fine. For instance M*A*S*H is all 30fps progressive.


Man, I would totally disagree with that .... almost *all* of the TV shows on DVD I have run into problems.

Nicias wrote:
Some old movies are labeled wrong. Willy Wonka and the Chocolate Factory (with Gene Wilder) is 24 fps but claims to be 30.


When you say 30 you mean NTSC, right? 29.97 fps

Nicias wrote:
Writing my own filter wasn't that hard. I don't mess with the frames at all, just their timing. I do math for a living, so the math part wasn't that hard. It took a while to figure the rest out. I figure, I use enough FOSS that I should give back now and then. Getting it added to the project was harder than writing the filter. Maybe I should say writing it well was harder than writing it poorly :)


Still very impressive. You deserve props. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Mon Feb 17, 2014 6:41 pm    Post subject: Reply with quote

dobbs wrote:
beandog wrote:
How is mencoder holding up these days? Still working okay? I haven't used it in a good while, heard that it has started getting some development love lately, but that could be old news too. It's been at least a year.

I'm not keeping tabs on it that closely, but development seems active. Even if not, it works as well as ever.


I've used mencoder extensively over the years, and the only places I've seen it deridden the most were on the actual mplayer mailing lists by the devs. I haven't followed the history for a while, but I remember that a developer did step in and started hacking on it again.

Historically, I've often seen people ask "why are you still using mencoder?!" so if I adopt that attitude, I'm probably just giving into bias.

My *biggest* use for it was always to do a rawcopy of the stream. There's still not a really *good* app that will just let you select the video title, the audio streams and the subtitles and just do a raw dump of it, so mencoder fits the bill nicely.

dobbs wrote:
Still doesn't produce files usable on my iPhone. I likely need to revert to encoding video and audio separately and then remuxing with ffmpeg. Though if HandbrakeCLI is as awesome as you say, I would rather use that.


If you're interested, I'll dig through my code and see what wrapper I came up with for HandBrake. It really does some great stuff.

Also, just coming back to Gentoo multimedia and looking over the forums, I'm noticing that nobody uses it or even knows about it. Makes me think that perhaps some good solid mid-user-level documentation could come in handy, do a fair assessment of pros vs cons of other DVD ripper apps.

dobbs wrote:
Huh, I expected TNG to be a pure NTSC process, so interlacing would be intrinsic. Did they use actual film? Maybe I'm overestimating DV's role in history.


IIRC, they used film and *then* added special effects over that. So, it's pretty ugly. However, TNG is on Blu-ray now, and I'll probably eventually move to purchasing / watching those, so it'll become a moot point. Regardless, the DVDs will always serve as a great point-of-reference for quality.

dobbs wrote:
I just wish I understood the motives behind the encoding.


Generally interlacing is done to save space. Makes sense on something like TNG where you have four hours on one DVD with multiple audio tracks (English Dolby 5.1, English Dolby stero, etc.).

In my ripper, I store all the stats about each individual DVD in a database, and that includes filesize of each DVD. Somewhere around here I have the total filesize for the entire 7 season run... it was a lot.
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Nicias
Guru
Guru


Joined: 06 Dec 2005
Posts: 446

PostPosted: Mon Feb 17, 2014 6:44 pm    Post subject: Reply with quote

Maybe, I mostly do movies. The other stuff I've had is relatively fine. I mean it is often telecined, either 23 or 23223 (or somesuch for PAL->NTSC) and yeah, 30=30000/1001.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum