[mythtv] FFmpeg plans

Peter Bennett pb.mythtv at gmail.com
Sat May 12 16:29:50 UTC 2018



On 05/12/2018 07:30 AM, Ian Campbell wrote:
> 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.
Thank you for the insight. This gives a better way of adding a subtree.
>
> 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).
It is a bit messy - 5 step process.
> 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).
The thing I was concerned about with that is that there are so many 
commits in FFmpeg compared with MythTV, that they would overwhelm the 
history. There are 91000 commits in the master branch of FFmpeg. I 
feared that the day I pulled in the subtree without squash, it may 
become very difficult to find anything useful pertaining to MythTV in 
the log. Perhaps that would only affect certain views of the log.

I am currently trying an approach of having a private copy of the FFmpeg 
repository. Then I can use the simpler option at the bottom of the 
stackoverflow  article, that says "Another more simple option, if you 
have access to the original subtree repository, is to make the cherry 
pick there in a branch and then just git subtree pull that specific 
branch.".

Peter


More information about the mythtv-dev mailing list