I don't think you can extract this information with INSERT IGNORE. Even if the warning text would contain the key value, there are only so many warnings buffered, so you couldn't rely on that.
I would probably try to rewrite the query so that it avoids inserting a duplicate. You can always detect the keys before hand by doing a
SELECT id FROM tab WHERE name in ('...value1...',...,'...valueN...')
Depending on the format of the data you want to insert, and how you are doing the inserts (bulk, or one row at a time) you can do several things to avoid inserting known duplicates.
If on the other hand you had the idea of extracting the IDs of the would-be duplicates to perform an update for those rows instead, then you should use the
REPLACE syntax (http://dev.mysql.com/doc/refman/5.1/en/replace.html) or the
ON DUPLICATE KEY UPDATE construct (http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html)