How best to count bees entering and leaving a hive to measure hive activity?
One thing that's certain is that the activity of bees varies according to time of day, so more important than how long you record for is probably at what time you record. If you always record at the same time of day, this should allow a reasonable comparison between results of different days. For example, recording from time 14:30 to 14:35 every day could be fine. You could then record conditions at this time each day (temperature, weather, etc.) along with this.

As for the exact length of your recordings: Of course, the longer they are, the better. More samples usually increases reliability and representativeness of your results. However, more importantly you want a practically useful time as well. This really depends on the actual number of bees entering into the hive within different time frames, as well as the baseline variability between days irrespective of the conditions you are investigating. I don't know anything about either of these :)

You want the number of entrances in your recording to be at a level where you will notice if there is a meaningful difference between days, and the only way of going about this is usually to start with a guess and then change if you notice that you can't really make sense of your results.