[mythtv] FFmpeg plans

Ian Campbell ijc at hellion.org.uk
Sat May 12 11:30:31 UTC 2018


On Fri, 2018-05-11 at 13:51 -0400, Peter Bennett wrote:
> In my own copy of MythTV repository, I tried using a subtree to include 
> FFmpeg. I hit up against a few problems -
> 
> I had wanted to try importing a particular commit from FFmpeg, but I was 
> unable to do that. I could only import the latest version of a branch. 
> Also I could see no way of cherry-picking FFmpeg commits into our copy.
> 
> git subtree add -P mythtv/external/FFmpeg 
> https://github.com/FFmpeg/FFmpeg.git 7e3a070 --squash
> fatal: Couldn't find remote ref 7e3a070
> 
> I tried adding it as a remote, with the same result
> 
> git remote add ffmpeg https://github.com/FFmpeg/FFmpeg.git
> git fetch ffmpeg
> git subtree add -P mythtv/external/FFmpeg ffmpeg 7e3a070 --squash
> fatal: Couldn't find remote ref 7e3a070

There are two forms of `git subtree add`:
>       git subtree add   -P <prefix> <commit>
>       git subtree add   -P <prefix> <repository> <ref>

You've tried the second one but I think you need the first, in a slight
modification to your second attempt with a remote:

   ijc at dagon:mythtv-subtree-test$ git remote add ffmpeg https://github.com/FFmpeg/FFmpeg.git
ijc at dagon:mythtv-subtree-test$ git fetch -n ffmpeg
warning: no common commits
[...]
ijc at dagon:mythtv-subtree-test$ git subtree add -P mythtv/external/FFmpeg-test 7e3a070 --squash
Added dir 'mythtv/external/FFmpeg-test'
ijc at dagon:mythtv-subtree-test$ ls mythtv/external/FFmpeg-test
Changelog        COPYING.GPLv2     CREDITS   INSTALL.md    libavformat/    libswresample/  Makefile   tests/
compat/          COPYING.GPLv3     doc/      libavcodec/   libavresample/  libswscale/     presets/   tools/
configure*       COPYING.LGPLv2.1  ffbuild/  libavdevice/  libavutil/      LICENSE.md      README.md
CONTRIBUTING.md  COPYING.LGPLv3    fftools/  libavfilter/  libpostproc/    MAINTAINERS     RELEASE

(I fudged the prefix because it already exists, but I guess you have
already done "git rm -r" to get rid of the old copy in your tree, I
used -n so I wouldn't get all the ffmpeg tags in my local repo). You
could avoid the remote by just doing:

   git fetch https://github.com/FFmpeg/FFmpeg.git <branch|commit>

instead of the `git remote add foo` + `git fetch -n foo`.

I've not looked at how this differs from the subtree merge command:

>       git subtree merge -P <prefix> <commit>

but I guess this is the one you want going forward after the initial
add.

For cherry-picking there is a process given in https://stackoverflow.co
m/questions/12978260/how-do-i-go-to-a-specific-commit-using-git-subtree
 (second half of first answer) which looks pretty plausible to me, but
it does rely on not using `--squash` for the regular merges (although
possibly it could be adapted).

TBH I'd recommend not using squash anyway, it'll give a more accurate
picture of the history which is useful for people doing archaeology
which crosses into the ffmpeg tree (it shows the actual upstream
commits and authors instead of the subtree-merger) and I think git does
a better job of merging etc if it has more granular history to look at
(e.g. I think it can spot when the same changes appear in two commits
in different branches, perhaps due to cherry-picking, which helps merge
do the right thing more often).

Ian.


More information about the mythtv-dev mailing list