We know how it ends.

That's the pity of it. We know that four years ago this month Amy Winehouse was found dead in her flat of alcohol poisoning. She was 27, a huge star and a tragedy just waiting to happen.

Or so it seemed. For years we had been reading stories about terrible gigs and missed gigs, stories of her drinking, stories of her druggy husband Blake, stories of her own drug habits, stories of not going to rehab (as the song said) and then going to rehab. We had seen pictures, terrible pictures, of a girl little more than skin and bone, a girl in a state of permanent disarray, a girl on the edge of falling off the world. That July she did.

Near the end of Asif Kapadia's powerful, painful new documentary Amy there are images of Winehouse taken in her flat; taken not long after she had won five Grammys. They are shocking images. Images of a woman hardly there; a ghost face, all shadow and emptiness. The word harrowing doesn't do them justice. These are pictures that are hard to look at.

"That is the girl under the make-up and under beehive," Kapadia points out. "That's what she really looks like and it's so sad, so sad. And unfortunately I've seen a lot more like that. That's the stuff we kept."

Kapadia's film, his follow-up to the critically lauded documentary on Formula One racing driver Senna, is at times a difficult and, yes, sad, watch. But it is also riveting. Better than Senna, I'd go as far to say.

It's no wonder it was raved about at Cannes earlier this year. Today he's brought it to Scotland for a showing at the Edinburgh International Film Festival ahead of its general release.

Kapadia is 43, an art school graduate turned film-maker who grew up in London. Amy is his first London film, he points out. It's one that began with a call from Universal, Winehouse's record label, asking him if he wanted to make a film about her. Warts and all.

"After Senna I got offered a lot of sports films. I love sport but I didn't really want to do another one. I liked that one." The call from Universal got him thinking. He had Winehouse's records but didn't know her, had never met her, even though he also lived in Camden. He thought there might be a story to uncover. "She was hugely famous but there were loads of questions. I didn't understand why it turned out the way it did."

His way into the film turned out to be Nick Shymansky, Winehouse's first manager, the person who was there at the very beginning of Winehouse's career. "I called him up and he said 'look, I think it's too soon. I don't think you should be doing this film. I'm not really interested. But I'm annoyed it's you guys calling up because I really liked Senna."

They met up anyway and talked. Kapadia showed him the research that he'd already put in and that seemed to swing it. Shymansky agreed to an interview. They spoke for five or six hours the first time and then they talked some more. "He really opened the door," says Kapadia, "and eventually trusted me enough to show me his laptop with all the video's he'd shot and answerphone messages. And then you feel, 'okay, we've got a film potentially'. Because you see this girl who we've got at the beginning of the film that I'd never seen before. She's funny, she's healthy. She's great. You like her."

You do. This is the teenage girl who wanted to be a jazz singer, a gobby, bolshy girl full of life and music. The one who dominates the first half of the film before the lights go out and things get dark. A girl who was not without her problems. She was a bulimic. A girl who was emotionally damaged when her father Mitch left her mother. But even so someone who is at the beginning of things. The shock is the end came so soon afterwards.

For some the turning point was when Winehouse met Blake Fielder-Civil, the man she would marry in 2007, separate from two years later and the man who inspired her album Back to Black. A man with longstanding and serious drug issues.

Kapadia isn't so sure Fielder-Civil can shoulder all the blame. "All the issues were already there. She just met someone who connected with her. They felt they had a lot in common and that was some of the darkness in both of them. Somehow drugs or whatever seemed to be an escape for them both.

"That's obviously a pivotal moment. But everything seemed to happen around that time." Everything included the death of her grandmother, a change of management (Shymansky backs out of the picture at this point; you see him do just that literally on screen), a chance of rehab that wasn't taken when maybe it should have been and could have helped.

"She was human," Kapadia says simply. "She had all this stuff going on. The problem was, I guess, when mega fame came along. I don't know if people would have come back into her life if she hadn't become a huge star and if there wasn't loads of money around.

"And once you become a mega star who is going to say no? Who is going to stop the ride? That is really where it all changes."

It is also the point in which the film becomes uncomfortable for everyone watching. Because we are the ones reading the stories, we are the ones snickering at the pictures, laughing at the jokes being told about her by comedians. "A good chunk of the world made fun of her because no one answered back. She didn't stop it. She wasn't litigious. There was nobody on her team that defended her."

That's when we see those images of her in her flat looking like, well, a dead woman walking frankly. Did Kapadia have any qualms about including them?

"For me it made the point. It was really tough footage to look at. She's not naked." He pauses, qualifies that. "She is naked, but not in the physical sense. Sadly, she used to walk around the streets with hardly any clothes on. She used to open the door and not be wearing anything. Sadly she just became a child by the latter period."

When the film was screened in Cannes, I say, Winehouse's family were upset and spoke out against it, particularly her father Mitch. "Not just particularly," Kapadia butts in before I finish. "Specifically. I don't think anyone else has."

It's fair to say Mitch does not emerge well from the film, especially in a sequence in which he brings a reality TV camera crew to Jamaica where his daughter gone to get away from things. You can see why he would be upset.

This is tricky stuff, Kapadia says. "I'm not the kind of guy who'd say 'I'm going to make a film to pick on people.' I hope it doesn't. The idea is to try to understand. It got confusing, it got muddy and messed up and people started making decisions which now you look at it and go 'that wasn't a great idea'. She was making a lot of decisions that were not the best thing for her. Everyone seemed sadly to make not one great decision after another which all added up to 'there's a car crash coming'."

And maybe by then the car crash ending was inevitable anyway.

"She had a lot of close calls. Her friends would say she had a lot of seizures, a lot of overdoses, a lot of moments when her heart stopped. But there was always someone there."

Until, of course, there wasn't.

Amy goes on general release tomorrow.